mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 19:52:40 +01:00
[youtube:tab] Detect playlists inside community posts
This commit is contained in:
parent
1ad047d0f7
commit
895b0931e5
@ -2958,12 +2958,19 @@ def _post_thread_entries(self, post_thread_renderer):
|
|||||||
return
|
return
|
||||||
# video attachment
|
# video attachment
|
||||||
video_renderer = try_get(
|
video_renderer = try_get(
|
||||||
post_renderer, lambda x: x['backstageAttachment']['videoRenderer'], dict)
|
post_renderer, lambda x: x['backstageAttachment']['videoRenderer'], dict) or {}
|
||||||
video_id = None
|
video_id = video_renderer.get('videoId')
|
||||||
if video_renderer:
|
if video_id:
|
||||||
entry = self._video_entry(video_renderer)
|
entry = self._extract_video(video_renderer)
|
||||||
if entry:
|
if entry:
|
||||||
yield entry
|
yield entry
|
||||||
|
# playlist attachment
|
||||||
|
playlist_id = try_get(
|
||||||
|
post_renderer, lambda x: x['backstageAttachment']['playlistRenderer']['playlistId'], compat_str)
|
||||||
|
if playlist_id:
|
||||||
|
yield self.url_result(
|
||||||
|
'https://www.youtube.com/playlist?list=%s' % playlist_id,
|
||||||
|
ie=YoutubeTabIE.ie_key(), video_id=playlist_id)
|
||||||
# inline video links
|
# inline video links
|
||||||
runs = try_get(post_renderer, lambda x: x['contentText']['runs'], list) or []
|
runs = try_get(post_renderer, lambda x: x['contentText']['runs'], list) or []
|
||||||
for run in runs:
|
for run in runs:
|
||||||
@ -2978,7 +2985,7 @@ def _post_thread_entries(self, post_thread_renderer):
|
|||||||
ep_video_id = YoutubeIE._match_id(ep_url)
|
ep_video_id = YoutubeIE._match_id(ep_url)
|
||||||
if video_id == ep_video_id:
|
if video_id == ep_video_id:
|
||||||
continue
|
continue
|
||||||
yield self.url_result(ep_url, ie=YoutubeIE.ie_key(), video_id=video_id)
|
yield self.url_result(ep_url, ie=YoutubeIE.ie_key(), video_id=ep_video_id)
|
||||||
|
|
||||||
def _post_thread_continuation_entries(self, post_thread_continuation):
|
def _post_thread_continuation_entries(self, post_thread_continuation):
|
||||||
contents = post_thread_continuation.get('contents')
|
contents = post_thread_continuation.get('contents')
|
||||||
|
Loading…
Reference in New Issue
Block a user