Skip to content

Instantly share code, notes, and snippets.

@mutaku
Last active December 22, 2015 04:49
Show Gist options
  • Save mutaku/6419558 to your computer and use it in GitHub Desktop.
Save mutaku/6419558 to your computer and use it in GitHub Desktop.
grabbing some diablo walls
import urllib
RESOLUTIONS = ['1024x768',
'1152x864',
'1280x800',
'1280x1024',
'1600x900',
'1600x1200',
'1680x1050',
'1920x1080',
'1920x1200']
URL = "http://media.blizzard.com/d3/media/wallpapers/wallpaper{0:03}/wallpaper{0:03}-{1}.jpg"
MAX_IMGS = 31
for (i, res) in [(i, res)
for i in xrange(1, MAX_IMGS + 1)
for res in RESOLUTIONS]:
try:
urllib.urlretrieve(URL.format(i, res),
"{}_{}.jpg".format(i, res))
except:
print "{} does not have resolution {}".format(i, res)
# ---> Or use beautiful soup and scrape <---
# grab list of all available walls as : <a id="wallpaper031" ..
# go to page and grab all resolution formats by all <a class="format" ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment