From da503b7a52645a52d6fcf11e3970655d51719801 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Tue, 20 Jul 2021 07:21:16 +0530 Subject: [PATCH] [youtube] Make `parse_time_text` and `_extract_chapters` non-fatal Related: #532, 7c365c210939bcf3497f212a163ca1987f189421 --- yt_dlp/extractor/youtube.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index a9c29062f..f44624e39 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -1950,7 +1950,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): content_list = traverse_obj( data, ('engagementPanels', ..., 'engagementPanelSectionListRenderer', 'content', 'macroMarkersListRenderer', 'contents'), - expected_type=list) + expected_type=list, default=[]) chapter_time = lambda chapter: parse_duration(self._get_text(chapter.get('timeDescription'))) chapter_title = lambda chapter: self._get_text(chapter.get('title')) @@ -1996,7 +1996,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor): """ time_text_split = time_text.split(' ') if len(time_text_split) >= 3: - return datetime_from_str('now-%s%s' % (time_text_split[0], time_text_split[1]), precision='auto') + try: + return datetime_from_str('now-%s%s' % (time_text_split[0], time_text_split[1]), precision='auto') + except ValueError: + return None def _extract_comment(self, comment_renderer, parent=None): comment_id = comment_renderer.get('commentId')