summaryrefslogtreecommitdiffstats
path: root/.local/bin/comicviewer
blob: ca173c51935ca8e04b8c32f3bc3b595626770165 (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
#!/bin/bash

input="$1"
function grab() { curl "$input" -L --silent -A "Mozilla" ; }
function viewer() { xargs curl --silent -A "Mozilla" | imv - ; }

if [[ $input =~ xkcd.com ]]; then grab | awk '/hotlinking/ {print $NF}'| viewer
elif [[ $input =~ arcaderage.co ]]; then grab | tr "\"" "\n" | awk -F\? '/uploads/ {print $1;exit}' | viewer
elif [[ $input =~ Buttersafe ]]; then grab | awk -F\" '/\/comics\// {print $2}' | viewer
elif [[ $input =~ dilbert.com ]]; then grab | awk -F\" '/data-image/ {print $2}' | viewer
elif [[ $input =~ donthitsave.com ]]; then grab | tr "\"" "\n" | awk '/comicimages/ {print $1;exit}' | viewer
elif [[ $input =~ commitstrip.com ]]; then grab | awk -F\" '/uploads/ && /wp-content/ {print $2}' | viewer
elif [[ $input =~ eatmypaint.co.uk ]]; then grab | tr "\"" "\n" | awk '/uploads/ {print $1;exit}' | viewer
elif [[ $input =~ explosm.net ]]; then grab | awk -F\" '/main-comic/ {print $4}' | cut -f1 -d\? | sed -e 's/^/"https:/' -e 's/$/"/' | viewer
elif [[ $input =~ extrafabulouscomics.com ]]; then grab | tr "\"" "\n" | awk -F\? '/uploads/ && /?/ {print $1}' | viewer
elif [[ $input =~ loadingartist.com ]]; then grab | tr "\"" "\n" | awk '/uploads/ && /wp-content/' | viewer
elif [[ $input =~ onegianthand.com ]]; then grab | tr "\"" "\n" | awk '/media/ && /1280/ {print $1;exit}' | viewer
elif [[ $input =~ PoorlyDrawnLines ]]; then grab | awk -F"src" '/wp-block-image/ {print $2}' | cut -f2 -d\" | viewer
elif [[ $input =~ satwcomic ]]; then grab | awk -F\" '/art/ && /core/ {print $4}' | viewer
elif [[ $input =~ smbc-comics.com ]]; then grab | tr "\"" "\n" | awk '/\/comics/ {print $1;exit}' | viewer
elif [[ $input =~ theoatmeal.com ]]; then grab | awk -F\" '/comics/ && /img src/ {print $2}' | viewer
elif [[ $input =~ toothpastefordinner.com ]]; then grab | awk -F\" '/max-width/ {print $4}' | viewer
elif [[ $input =~ woodenplankstudios.com.com ]]; then grab | tr "\"" "\n" | awk '/scaled/ {print $1}' | viewer
else echo "Unsupported Website."; fi