Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Download simpledesktops wallpapers
"""Download a whole page of wallpapers from
- BeautifulSoup:
$ ./ ""
Downloading 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment