#!/usr/bin/python """Download a whole page of wallpapers from simpledesktops.com. Requires: - BeautifulSoup: http://www.crummy.com/software/BeautifulSoup/#Download Usage: $ ./simpledesktops_download.py "http://simpledesktops.com/browse/6/" Downloading http://parsed.url.com/directory/subdir/wallpaper.png to wallpaper.png - Please be gentle when downloading files. - Browse around their site to give them support! """ __author__ = "Will Nowak " import urllib import urlparse import os from BeautifulSoup import BeautifulSoup import sys b = BeautifulSoup(urllib.urlopen(sys.argv[1]).read()) for x in b.findAll(attrs={'class':'desktop'}): uri = x.find('a')['href'] parsed = urlparse.urlparse(uri) f = os.path.basename(parsed.path) print 'Downloading %s to %s' % (uri, f) urllib.urlretrieve(x.find('a')['href'], f)