[ie/youtube:tab] Improve shorts title extraction (#11991) (#11997)

Closes #11991
Authored by: d3d9, bashonly

Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
pull/12194/head
kibaa 2 days ago committed by GitHub
parent b3007c44cd
commit 76ac023ff0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5370,10 +5370,12 @@ class YoutubeTabBaseInfoExtractor(YoutubeBaseInfoExtractor):
yield self.url_result(
f'https://www.youtube.com/shorts/{video_id}',
ie=YoutubeIE, video_id=video_id,
**traverse_obj(renderer, ('overlayMetadata', {
'title': ('primaryText', 'content', {str}),
'view_count': ('secondaryText', 'content', {parse_count}),
})),
**traverse_obj(renderer, {
'title': ((
('overlayMetadata', 'primaryText', 'content', {str}),
('accessibilityText', {lambda x: re.fullmatch(r'(.+), (?:[\d,.]+(?:[KM]| million)?|No) views? - play Short', x)}, 1)), any),
'view_count': ('overlayMetadata', 'secondaryText', 'content', {parse_count}),
}),
thumbnails=self._extract_thumbnails(renderer, 'thumbnail', final_key='sources'))
return

Loading…
Cancel
Save