mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 18:34:41 +01:00
[ie/youtube:tab] Fix shorts tab extraction (#10938)
Closes #10936 Authored by: seproDev
This commit is contained in:
parent
3a3bd00037
commit
9431777b4c
@ -5088,7 +5088,7 @@ def _playlist_entries(self, video_list_renderer):
|
||||
def _rich_entries(self, rich_grid_renderer):
|
||||
renderer = traverse_obj(
|
||||
rich_grid_renderer,
|
||||
('content', ('videoRenderer', 'reelItemRenderer', 'playlistRenderer')), get_all=False) or {}
|
||||
('content', ('videoRenderer', 'reelItemRenderer', 'playlistRenderer', 'shortsLockupViewModel'), any)) or {}
|
||||
video_id = renderer.get('videoId')
|
||||
if video_id:
|
||||
yield self._extract_video(renderer)
|
||||
@ -5100,6 +5100,21 @@ def _rich_entries(self, rich_grid_renderer):
|
||||
ie=YoutubeTabIE.ie_key(), video_id=playlist_id,
|
||||
video_title=self._get_text(renderer, 'title'))
|
||||
return
|
||||
# shortsLockupViewModel extraction
|
||||
entity_id = renderer.get('entityId')
|
||||
if entity_id:
|
||||
video_id = traverse_obj(renderer, ('onTap', 'innertubeCommand', 'reelWatchEndpoint', 'videoId', {str}))
|
||||
if not video_id:
|
||||
return
|
||||
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}),
|
||||
})),
|
||||
thumbnails=self._extract_thumbnails(renderer, 'thumbnail', final_key='sources'))
|
||||
return
|
||||
|
||||
def _video_entry(self, video_renderer):
|
||||
video_id = video_renderer.get('videoId')
|
||||
|
Loading…
Reference in New Issue
Block a user