2007-01-02

Comics

If you want to watch daily comics, but need to load the pathetic 206KB of content for the 37KB image, you can script the download of it with curl and egrep.

#!/bin/bash
# Download comics and put them in the users web directory

if [ -z "$1" ]
then
DATE=`date +"%Y%m%d"`
else
DATE=$1
fi
IMG=`curl -s http://www.comics.com/comics/pearls/archive/pearls-${DATE}.html \
| egrep -m 1 -o "/comics/pearls/archive/images/pearls[0-9]+.(gif|jpg)"`
mkdir -p $HOME/public_html/comics/
cd $HOME/public_html/comics/
wget -q http://www.comics.com$IMG

And there you go. You will download the 53KB HTML page and fetch the 37KB image which makes you a ratio of 0.44:1.

The script downloads the comics of the day by default, or you can pass it a date as first parameter. A good place for this script is your cron table.

I'm gonna improve this script each time I find a new comic now on.

Edit: you can follow the changes here.

No comments:

Post a Comment