summaryrefslogtreecommitdiffstats
path: root/.local/bin/comicviewer
blob: c8be7135075477debdb6507b437a0114429c9fb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

function _curl() { curl -L --silent -A \"Mozilla\" "$@" ; }
function _view() { imv -f - ; }
function grab() { _curl "$1" | tr "\"" "\n" ; }

if [[ $1 =~ youtube.com ]]; then mpv --ytdl=no --fullscreen --volume=100 "$@"
elif [[ $1 =~ arcaderage.co ]]; then _curl "$(grab "$@" | awk -F"?" '/uploads/ {print $1;exit}')" | _view
elif [[ $1 =~ Buttersafe ]]; then _curl "$(grab "$@" | awk '/comics/')" | _view
elif [[ $1 =~ commitstrip.com ]]; then _curl "$(grab "$@" | awk '/uploads/ && !/Template/')" | _view
elif [[ $1 =~ dilbert.com ]]; then _curl "$(grab "$@" | awk '/https/ && /amuniversal/ {print $1;exit}')" | _view
elif [[ $1 =~ donthitsave.com ]]; then _curl "$(grab "$@" | awk todo)" | _view
elif [[ $1 =~ eatmypaint.co.uk ]]; then _curl "$(grab "$@" | awk '/uploads/ {print $1;exit}')" | _view
elif [[ $1 =~ explosm.net ]]; then _curl "$(grab "$@" | awk -F"?" '/comics/ && /png/ || /jpg/ {print $1;exit}')" | _view
elif [[ $1 =~ extrafabulouscomics.com ]]; then _curl "$(grab "$@" | awk todo)" | _view
elif [[ $1 =~ goodbearcomics ]]; then _curl "$(grab "$@" | grep "$(date +%Y)" | awk '/png/ {print $1;exit}')" | _view
elif [[ $1 =~ lastplacecomics.com ]]; then _curl "$(grab "$@" | awk '/uploads/ && /content/ {print $1;exit}')" | _view
elif [[ $1 =~ loadingartist.com ]]; then _curl "$(grab "$@" | awk '/uploads/ && /content/')" | _view
elif [[ $1 =~ lolnein.com ]]; then _curl "$(grab "$@" | awk '/comics/ && /png/')" | _view
elif [[ $1 =~ onegianthand.com ]]; then _curl "$(grab "$@" | awk '/media/ && /1280/ {print $1;exit}')" | _view
elif [[ $1 =~ PoorlyDrawnLines ]]; then _curl "$(grab "$@" | awk '/uploads/ {print $1;exit}')" | _view
elif [[ $1 =~ satwcomic ]]; then _curl "$(grab "$@" | awk '/\/art\// && ! /thumb/ {print $1;exit}')" | _view
elif [[ $1 =~ smbc-comics.com ]]; then _curl "$(grab "$@" | awk '/\/comics\// {print $1;exit}')" | _view
elif [[ $1 =~ theoatmeal.com ]]; then _curl "$(grab "$@" | awk '/comics/ && /amazonaws/')" | _view
elif [[ $1 =~ toothpastefordinner.com ]]; then _curl "$(grab "$@" | awk '/gif/')" | _view
elif [[ $1 =~ woodenplankstudios.com ]]; then _curl "$(grab "$@" | awk todo)" | _view
elif [[ $1 =~ xkcd.com ]]; then _curl "$(grab "$@" | awk '/comics/ && /png/ {print $1;exit}')" | _view
else echo "Unsupported Website."; fi