views:

144

answers:

1

I've tried using the following commands to download the ctrl alt del comics.

$ for filename in $(seq 20021023 20100503); do wget http://www.ctrlaltdel-online.com/comics/"$filename".jpg; done

I get the following error code, "bash: syntax error near unexpected token 'do'"

I've also tried using cURL, using this command,

curl http://ctrlaltdel-online.com/comics[20021023..20100503].jpg

I get the following error code, "curl: (3) [globbing] error: bad range specification after pos 37"

Any help would be great.

+1  A: 

As msw pointed out, crawling a site could be either illegal, unethical, irritating to the author, or perfectly fine. Please use your scripting powers responsibly and for Good (tm). Asking permission would certainly be a nice thing to do.

Note that the ctrlaltdel-online.com web server seems to return HTTP 403 forbidden to wget with the normal wget User-Agent string. Emulating something Firefox-ish seems to bypass that (although I bet they are just explicitly denying wget, which indicates they most likely forbid this type of access).

USERAGENT='Mozilla/5.0 Firefox/3.6.3'
for DAYS in $(seq 365)
do
    NEXT=`date -d "${DAYS} days ago" +%Y%m%d`
    wget -U "${USERAGENT}" "http://www.cad-comic.com/comics/cad/${NEXT}.jpg"
done

Replace 365 with a larger number to go back more than a year. The wget output might be annoying, so you can pass it -q to make it quiet.

Peter Lyons