Saturday, September 6, 2008

Download all xkcd

You can now download all xkcd comics in one go using the following bash script.


#!/bin/bash
for i in `seq 1 472`
do
wget http://xkcd.com/$i/
wget `grep http://imgs.xkcd.com/comics/ index.html | head -1 | cut -d\" -f2`
mv `grep http://imgs.xkcd.com/comics/ index.html | head -1 | cut -d\/ -f5 | cut -d\" -f1` $(echo $(echo $i"_")`grep http://imgs.xkcd.com/comics/ index.html | head -1 | cut -d\/ -f5 | cut -d\" -f1`)

rm index.html
done



Made a few modifications to the earlier code so that the comics are named according the sequence that they were put up.

Make the file executable and execute as ::

$sh filename


Happy reading.
Share/Save/Bookmark

8 comments:

Aditya said...

Yay....

@$%deja vu$% said...

good good....
creative work !!:)

Salil said...

keep it up dude, niiiccceee!! :-)

Amod said...

explain that script please !!

Aditya said...

See... I told you the first time. Download first and then rename. Don't try to do both things at the same time... but you don't listen....

CDK said...

@aditya:: aah...yes...i forget....it was ur idea...thanks for that..and i did the same thing eventually...
so i did listen

Aniket Zamwar said...

wat is dis..
wats dis for??

CDK said...

@aniket:: check the previous posts regarding xkcd ... its a webcomic