1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-11-22 15:02:56 +08:00

Added duration for YouTube videos

This commit is contained in:
Tailszefox 2012-10-22 18:32:42 +02:00
parent c6c0e23a32
commit 2262a32dd7

View File

@ -414,6 +414,12 @@ class YoutubeIE(InfoExtractor):
except Trouble as trouble:
self._downloader.trouble(trouble[0])
if 'length_seconds' not in video_info:
self._downloader.trouble(u'WARNING: unable to extract video duration')
video_duration = ''
else:
video_duration = urllib.unquote_plus(video_info['length_seconds'][0])
# token
video_token = urllib.unquote_plus(video_info['token'][0])
@ -480,7 +486,8 @@ class YoutubeIE(InfoExtractor):
'thumbnail': video_thumbnail.decode('utf-8'),
'description': video_description,
'player_url': player_url,
'subtitles': video_subtitles
'subtitles': video_subtitles,
'duration': video_duration
})
return results