A feature-rich command-line audio/video downloader
[ie/youtube:tab] Fix approximate timestamp extraction for feeds (#14539)
coletdjnzccc25d6710a4
diff --git a/yt_dlp/extractor/youtube/_base.py b/yt_dlp/extractor/youtube/_base.pyindex 47e09c4f21..ded43b8aea 100644--- a/yt_dlp/extractor/youtube/_base.py+++ b/yt_dlp/extractor/youtube/_base.py@@ -1196,7 +1196,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):except ValueError:return None- def _parse_time_text(self, text):+ def _parse_time_text(self, text, report_failure=True):if not text:returndt_ = self.extract_relative_time(text)@@ -1211,7 +1211,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):(r'([a-z]+\s*\d{1,2},?\s*20\d{2})', r'(?:.+|^)(?:live|premieres|ed|ing)(?:\s*(?:on|for))?\s*(.+\d)'),text.lower(), 'time text', default=None)))- if text and timestamp is None and self._preferred_lang in (None, 'en'):+ if report_failure and text and timestamp is None and self._preferred_lang in (None, 'en'):self.report_warning(f'Cannot parse localized time text "{text}"', only_once=True)return timestampdiff --git a/yt_dlp/extractor/youtube/_tab.py b/yt_dlp/extractor/youtube/_tab.pyindex 5870786978..72a66e0a1a 100644--- a/yt_dlp/extractor/youtube/_tab.py+++ b/yt_dlp/extractor/youtube/_tab.py@@ -341,7 +341,11 @@ class YoutubeTabBaseInfoExtractor(YoutubeBaseInfoExtractor):'contentImage', *thumb_keys, 'thumbnailViewModel', 'image'), final_key='sources'),duration=traverse_obj(view_model, ('contentImage', 'thumbnailViewModel', 'overlays', ..., 'thumbnailOverlayBadgeViewModel',- 'thumbnailBadges', ..., 'thumbnailBadgeViewModel', 'text', {parse_duration}, any)))+ 'thumbnailBadges', ..., 'thumbnailBadgeViewModel', 'text', {parse_duration}, any)),+ timestamp=(traverse_obj(view_model, (+ 'metadata', 'lockupMetadataViewModel', 'metadata', 'contentMetadataViewModel', 'metadataRows',+ ..., 'metadataParts', ..., 'text', 'content', {lambda t: self._parse_time_text(t, report_failure=False)}, any))+ if self._configuration_arg('approximate_date', ie_key=YoutubeTabIE) else None))def _rich_entries(self, rich_grid_renderer):if lockup_view_model := traverse_obj(rich_grid_renderer, ('content', 'lockupViewModel', {dict})):