Skip to content

Instantly share code, notes, and snippets.

@ihercowitz
Created May 12, 2014 00:59
Show Gist options
  • Save ihercowitz/31e9fea7e011e19e3372 to your computer and use it in GitHub Desktop.
Save ihercowitz/31e9fea7e011e19e3372 to your computer and use it in GitHub Desktop.
downloading the disney photopass files like a boss (for free)
import requests
import shutil
from lxml.html import fromstring
DPP='http://www.disneyphotopass.com'
html = fromstring(open('photopassinfos.html', 'r').read())
imgs = html.cssselect('img')
for index, img in enumerate(imgs):
tmp = img.get('src').replace('=36', '=3096').replace('=70', '=300') + '&aspectRatio=EightByTen'
response = requests.get(DPP+tmp, stream=True)
with open('disney/'+str(index)+'.jpg', 'wb') as outf:
shutil.copyfileobj(response.raw, outf)
del response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment