, . - - wget, Earwicker.
, , . Python - , - , urllib , . URL- .
XKCD, , :
import re, urllib
root_url = 'http://xkcd.com/'
img_url = r'http://imgs.xkcd.com/comics/'
dl_dir = '/path/to/download/directory/'
page = urllib.urlopen(root_url).read()
comic = re.match(r'%s[\w]+?\.(png|jpg)' % img_url, page)
fname = re.sub(img_url, '', comic)
try:
image = urllib.urlretrieve(comic, '%s%s' % (dl_dir, fname))
except ContentTooShortError:
print 'Download interrupted.'
else:
print 'Download successful.'
, .