Created
April 7, 2015 17:05
-
-
Save sdeancos/7b1c84052b27818b00e7 to your computer and use it in GitHub Desktop.
quick&dirty download photos PyConEs2014 ZGZ
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/env python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # download_photos_pycones2014.py | |
| import urllib2, shutil | |
| from BeautifulSoup import BeautifulSoup | |
| def main(): | |
| host = 'http://2014.es.pycon.org/static/fotos/' | |
| page = BeautifulSoup(urllib2.urlopen(host+'index.html')) | |
| images = page.findAll('img') | |
| for image in images: | |
| name = image.get('data-title') | |
| binary_photo = urllib2.urlopen(host+name) | |
| with open(name, 'wb') as fp: | |
| shutil.copyfileobj(binary_photo, fp) | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment