Created
July 17, 2011 12:20
-
-
Save ftao/1087521 to your computer and use it in GitHub Desktop.
This file contains 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
# python ep2011_video.py | tee ep2011_video.txt | |
import httplib2 | |
import urlparse | |
from BeautifulSoup import BeautifulSoup | |
BASE_URL = 'http://ep2011.europython.eu/' | |
SCHEDULE_URL = 'http://ep2011.europython.eu/p3/schedule/ep2011/' | |
headers = { | |
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", | |
"Accept-Charset": "UTF-8,*;q=0.5", | |
"Accept-Encoding": "gzip,deflate,sdch", | |
"Accept-Language": "zh-CN,zh;q=0.8", | |
"Cache-Control": "max-age=0", | |
"Connection": "keep-alive", | |
"Cookie": "__utmz=216266434.1308924252.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); hblid=5KQRF96ITD5PMHVS3689FCST17511211; wcsid=GN1CXLHFMHVKYFKE5ZF7YMSN17511211; _ok=1751-12112149-10-1389; omp__super_properties=%7B%22all%22%3A%20%7B%22distinct_id%22%3A%20%22QXZ9S2A2N94BWF0WJ889WUSG17511211%22%7D%2C%22events%22%3A%20%7B%7D%2C%22funnels%22%3A%20%7B%7D%7D; __utma=216266434.366913138.1308924252.1308924252.1308988266.2; __utmc=216266434; __utmb=216266434.4.10.1308988266; olarkld=1308924252296; csrftoken=8ee2db1c95dfd62364e59b09ea4f762c; olfsk=olfsk8661665096879005; _oklv=1308989367776; _okbk=cd5%3Daway%2Ccd4%3Dtrue%2Cvi5%3D0%2Cvi4%3D1308988272036%2Cvi3%3Dactive%2Cvi2%3Dfalse%2Cvi1%3Dfalse%2Ccd8%3Dchat%2Ccd6%3D0%2Ccd3%3Dfalse%2Ccd2%3D0%2Ccd1%3D0%2C", | |
"Referer": "http://ep2011.europython.eu/conference/talks/ubuntu-and-the-opportunistic-programming", | |
"User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.91 Safari/534.30", | |
} | |
h = httplib2.Http() | |
resp, content = h.request(SCHEDULE_URL, headers=headers) | |
doc = BeautifulSoup(content) | |
for l in (a.get('href') for a in doc.findAll('a')): | |
l = urlparse.urljoin(SCHEDULE_URL, l) | |
if l.startswith('http://ep2011.europython.eu/conference/talks/'): | |
video_l = "%s/video.mp4" % l | |
h = httplib2.Http() | |
h.follow_redirects = False | |
resp, content = h.request(video_l, 'HEAD', headers=headers) | |
if resp['status'] != '404': | |
if resp['status'] == '302': | |
video_l = resp['location'] | |
print video_l.replace('?torrent', '') |
This file contains 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
http://ep2011.s3-eu-west-1.amazonaws.com/videos/pypy-hands-on.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/pypy-hands-on.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/advanced-aspects-django-ecosystem-haystack-celery-fabric.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/pythons-other-collection-types-and-algorithms.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/building-website-pyhp-and-liwe.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/experiences-making-cpu-bound-tasks-run-much-faster.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/best-practices-for-python-in-the-cloud.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/pyhp-and-art-dating-girls.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/data-plumbing-with-python.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/google-api-platform.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/every-time-you-use-viri-god-kills-a-sysadmin.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/using-python-in-software-for-the-medical-industry.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/cloud-service-api-mashups-in-a-python-web-application.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/ubuntu-programmazione-occasionale.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/sqlkit-database-ad-accesso-immediato.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/building-website-pyhp-and-liwe.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/challenges-building-large-django-site.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/python-at-cloudkick.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/developing-cutting-edge-applications-with-pyqt.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/exploring-cpythons-bytecode.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/a-deep-dive-into-python-classes.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/python-and-oracle-performance.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/experiences-making-cpu-bound-tasks-run-much-faster.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/gestione-di-processi-clinici-in-python-un-caso-duso.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/developing-cutting-edge-applications-with-pyqt.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/python-and-oracle-performance.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/building-a-scientific-software-application-with-the-enthought-tool-suite.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/social-network-analysis-con-python.mp4 | |
http://ep2011.s3-eu-west-1.amazonaws.com/videos/building-a-scientific-software-application-with-the-enthought-tool-suite.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment