Skip to content

Instantly share code, notes, and snippets.

@yanbe yanbe/
Created Nov 24, 2008

What would you like to do?
Download all dilbert comics from 1900-1-1 to today
#!/usr/bin/env python
import urllib2
import datetime
offset = 33039 #initial id
first = datetime.datetime(1990,1,1) #initial date
today =
for i in xrange(offset, offset+(today-first).days):
_dirs = [0]
for j in range(9,1,-1):
p = 10**j
url = ""
for k,e in enumerate(_dirs):
if k:
url+="".join(["%0",str(10-k),"d/"]) % e
url+="%d.strip.gif" % i
c = urllib2.urlopen(url)
if c.headers['content-type'] == 'image/gif':
file(filename, "wb").write(

This comment has been minimized.

Copy link

chka commented Nov 20, 2014

Nice job!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.