add youtube playlist parser

This commit is contained in:
j 2013-06-12 18:28:19 +02:00
parent f3d91b78d6
commit e2bffccd36

View file

@ -120,6 +120,16 @@ def videos(id, format=''):
streams[stream['itag']] = stream
return streams
def playlist(url):
data = read_url(url)
items = []
for i in list(set(re.compile('<a href="(/watch\?v=.*?)" title="(.*?)" ').findall(data))):
items.append({
'title': i[1],
'url': 'http://youtube.com' + i[0].split('&amp;')[0]
})
return items
def download_webm(id, filename):
stream_type = 'video/webm'
url = "http://www.youtube.com/watch?v=%s" % id