diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2012-10-23 05:53:28 -0700 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2012-10-23 05:53:28 -0700 |
commit | ece34e8951b05fb6661722d545969e24d82421cd (patch) | |
tree | c36e548128818b6591e89afe02dd89a03e26aece | |
parent | c6c0e23a32ffb9f2e5657aceaede7da1fb44e490 (diff) | |
parent | 2262a32dd784a4e3f49f68b96f5cc5294c6504b7 (diff) |
Merge pull request #486 from Tailszefox/local
Added duration for YouTube videos
-rw-r--r-- | youtube_dl/InfoExtractors.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 6bf80900f..6e59ba8fd 100644 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -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 |