mirror of https://github.com/yt-dlp/yt-dlp.git
[youtube] Make `parse_time_text` and `_extract_chapters` non-fatal
Related: #532, 7c365c2109
This commit is contained in:
parent
7c365c2109
commit
da503b7a52
|
@ -1950,7 +1950,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
content_list = traverse_obj(
|
content_list = traverse_obj(
|
||||||
data,
|
data,
|
||||||
('engagementPanels', ..., 'engagementPanelSectionListRenderer', 'content', 'macroMarkersListRenderer', 'contents'),
|
('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_time = lambda chapter: parse_duration(self._get_text(chapter.get('timeDescription')))
|
||||||
chapter_title = lambda chapter: self._get_text(chapter.get('title'))
|
chapter_title = lambda chapter: self._get_text(chapter.get('title'))
|
||||||
|
|
||||||
|
@ -1996,7 +1996,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
"""
|
"""
|
||||||
time_text_split = time_text.split(' ')
|
time_text_split = time_text.split(' ')
|
||||||
if len(time_text_split) >= 3:
|
if len(time_text_split) >= 3:
|
||||||
|
try:
|
||||||
return datetime_from_str('now-%s%s' % (time_text_split[0], time_text_split[1]), precision='auto')
|
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):
|
def _extract_comment(self, comment_renderer, parent=None):
|
||||||
comment_id = comment_renderer.get('commentId')
|
comment_id = comment_renderer.get('commentId')
|
||||||
|
|
Loading…
Reference in New Issue