From a353beba8328869f8ac4fbe8109f050d504c11da Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sat, 24 Jul 2021 06:23:02 +0530 Subject: [PATCH] [youtube:tab] Extract video duration early Based on: https://github.com/ytdl-org/youtube-dl/pull/29487 by glenn-slayden --- yt_dlp/extractor/youtube.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 48fc460ef..6c10cca22 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -809,7 +809,8 @@ def _extract_video(self, renderer): video_id = renderer.get('videoId') title = self._get_text(renderer, 'title') description = self._get_text(renderer, 'descriptionSnippet') - duration = parse_duration(self._get_text(renderer, 'lengthText')) + duration = parse_duration(self._get_text( + renderer, 'lengthText', ('thumbnailOverlays', ..., 'thumbnailOverlayTimeStatusRenderer', 'text'))) view_count_text = self._get_text(renderer, 'viewCountText') or '' view_count = str_to_int(self._search_regex( r'^([\d,]+)', re.sub(r'\s', '', view_count_text),