Skip to content

Instantly share code, notes, and snippets.

@sdeancos
Created April 7, 2015 17:05
Show Gist options
  • Select an option

  • Save sdeancos/7b1c84052b27818b00e7 to your computer and use it in GitHub Desktop.

Select an option

Save sdeancos/7b1c84052b27818b00e7 to your computer and use it in GitHub Desktop.
quick&dirty download photos PyConEs2014 ZGZ
#!/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