add some formats found on http://en.wikipedia.org/wiki/YouTube
This commit is contained in:
parent
b643997518
commit
ef49aae822
1 changed files with 8 additions and 0 deletions
|
@ -19,12 +19,18 @@ def getVideoKey(youtubeId):
|
||||||
|
|
||||||
def getVideoUrl(youtubeId, format='mp4'):
|
def getVideoUrl(youtubeId, format='mp4'):
|
||||||
youtubeKey = getVideoKey(youtubeId)
|
youtubeKey = getVideoKey(youtubeId)
|
||||||
|
if format == '1080p':
|
||||||
|
fmt=37
|
||||||
|
url = "http://youtube.com/get_video.php?video_id=%s&t=%s&fmt=%s" % (youtubeId, youtubeKey, fmt)
|
||||||
if format == '720p':
|
if format == '720p':
|
||||||
fmt=22
|
fmt=22
|
||||||
url = "http://youtube.com/get_video.php?video_id=%s&t=%s&fmt=%s" % (youtubeId, youtubeKey, fmt)
|
url = "http://youtube.com/get_video.php?video_id=%s&t=%s&fmt=%s" % (youtubeId, youtubeKey, fmt)
|
||||||
elif format == 'mp4':
|
elif format == 'mp4':
|
||||||
fmt=18
|
fmt=18
|
||||||
url = "http://youtube.com/get_video.php?video_id=%s&t=%s&fmt=%s" % (youtubeId, youtubeKey, fmt)
|
url = "http://youtube.com/get_video.php?video_id=%s&t=%s&fmt=%s" % (youtubeId, youtubeKey, fmt)
|
||||||
|
elif format == 'high':
|
||||||
|
fmt=35
|
||||||
|
url = "http://youtube.com/get_video.php?video_id=%s&t=%s&fmt=%s" % (youtubeId, youtubeKey, fmt)
|
||||||
else:
|
else:
|
||||||
url = "http://youtube.com/get_video.php?video_id=%s&t=%s" % (youtubeId, youtubeKey)
|
url = "http://youtube.com/get_video.php?video_id=%s&t=%s" % (youtubeId, youtubeKey)
|
||||||
return url
|
return url
|
||||||
|
@ -51,8 +57,10 @@ def getInfoFromAtom(entry, video_url_base=None):
|
||||||
info['mp4'] = "%s/%s.%s" % (video_url_base, info['id'], 'mp4')
|
info['mp4'] = "%s/%s.%s" % (video_url_base, info['id'], 'mp4')
|
||||||
else:
|
else:
|
||||||
info['flv'] = getVideoUrl(info['id'], 'flv')
|
info['flv'] = getVideoUrl(info['id'], 'flv')
|
||||||
|
info['flv_high'] = getVideoUrl(info['id'], 'high')
|
||||||
info['mp4'] = getVideoUrl(info['id'], 'mp4')
|
info['mp4'] = getVideoUrl(info['id'], 'mp4')
|
||||||
info['720p'] = getVideoUrl(info['id'], '720p')
|
info['720p'] = getVideoUrl(info['id'], '720p')
|
||||||
|
info['1080p'] = getVideoUrl(info['id'], '1080p')
|
||||||
info['embed'] = '<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/%s&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/%s&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>' % (info['id'], info['id'])
|
info['embed'] = '<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/%s&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/%s&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>' % (info['id'], info['id'])
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue