Posts Tagged ‘xkcd’

Downloading comics

Not wanting to browse through the entire collections of some webcomics, I wrote a short shell script that downloads them all for you. It’s relatively easy to modify it for different webcomics. Here’s one for SMBC:

#!/bin/bash
for i in {1..1805}
do
 wget -O- "http://www.smbc-comics.com/index.php?db=comics&id=$i#comic" | grep -o -e 'http://[a-zA-Z0-9]*\.smbc-comics.com\/comics\/200[0-9\-]*\.[a-z]*' | line | xargs wget
done

and one for XKCD:

#!/bin/bash
 for i in {1..710}
 do
 wget -O- "http://www.xkcd.com/$i/" | grep -o -e 'http://imgs\.xkcd\.com\/comics\/[a-zA-Z_]*\.[a-z][a-z][a-z]' | line | xargs wget
 done

Note: The numbers (1805 and 710) are just above their current number of strips, they will have to be increased as new strips are published.

Note2: If you’re using the KDE4 Desktop, try the Comic Strip plasmoid. It’s really nice, but doesn’t give you the option to download the whole comic. I might try to fix that.