[Tfug] Today's xkcd
Jeff Breadner
jeff at breadner.net
Thu May 1 11:13:08 MST 2008
Chris Hill wrote:
> Flash is pulling the url of the strip via xml from this url:
> http://www.dilbert.com/xml/widget.660/?StripID=2982&Year=2008&Month=5&Day=1&t=1209660080
>
> And it gets back an xml doc with the following:
>
It's easier than that; with the Dilbert page the way it is now, for
those browsers that don't have JS enabled, there is a standard <img> tag
that points to a GIF:
/dyn/str_strip/000000000/00000000/0000000/000000/00000/2000/200/2982/2982.strip.print.gif
Once the JS kicks in, then that <div> is overwritten with the
JS-enabled comic viewer. But, you can just wget the http://dilbert.com
page, then grep/sed out the relevant URL:
=================
#!/bin/bash
cd /tmp
url="http://www.dilbert.com"$(wget -O - -q http://www.dilbert.com/strips
| grep dyn | grep -v Thumb | sed -e 's/^.*src="//' -e 's/" \/>.*$//')
wget -q $url
img=$(basename $url)
echo "Dilbert Daily Strip" | /usr/bin/mutt -s "Dilbert Daily Strip" -a
$img me at mydomain.com
rm -f $img
=================
The right grep/sed command has to be developed for each comic, but it
works pretty well once it's developed. Until they go and change their
page again ;p
I've got a larger framework to download multiple comics and put them all
into one email, I'll get the code cleaned up in the next day or so and
post it somewhere.
cheers
JB
More information about the tfug
mailing list