Created
December 13, 2010 11:33
-
-
Save compbrain/738917 to your computer and use it in GitHub Desktop.
Download simpledesktops wallpapers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 <[email protected]>" | |
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