mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 20:30:41 -05:00
Added duration for YouTube videos
This commit is contained in:
parent
c6c0e23a32
commit
2262a32dd7
1 changed files with 8 additions and 1 deletions
|
@ -414,6 +414,12 @@ def _real_extract(self, url):
|
||||||
except Trouble as trouble:
|
except Trouble as trouble:
|
||||||
self._downloader.trouble(trouble[0])
|
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
|
# token
|
||||||
video_token = urllib.unquote_plus(video_info['token'][0])
|
video_token = urllib.unquote_plus(video_info['token'][0])
|
||||||
|
|
||||||
|
@ -480,7 +486,8 @@ def _real_extract(self, url):
|
||||||
'thumbnail': video_thumbnail.decode('utf-8'),
|
'thumbnail': video_thumbnail.decode('utf-8'),
|
||||||
'description': video_description,
|
'description': video_description,
|
||||||
'player_url': player_url,
|
'player_url': player_url,
|
||||||
'subtitles': video_subtitles
|
'subtitles': video_subtitles,
|
||||||
|
'duration': video_duration
|
||||||
})
|
})
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue