summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRemita Amine <[email protected]>2021-03-25 12:53:18 +0100
committerRemita Amine <[email protected]>2021-03-25 12:53:18 +0100
commit605e7b5e47c60c3ed7c2ca71df4d6bbd49fa8a77 (patch)
tree1fd6971ce9eea426de2e1c33597211f8fb7ef18f
parent8562218350a79d4709da8593bb0c538aa0824acf (diff)
downloadyoutube-dl-605e7b5e47c60c3ed7c2ca71df4d6bbd49fa8a77.tar.gz
youtube-dl-605e7b5e47c60c3ed7c2ca71df4d6bbd49fa8a77.zip
[youtube:tab] fix playlist/comunity continuation items extraction(closes #28266)
-rw-r--r--youtube_dl/extractor/youtube.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index badca3977..faf3a344e 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -24,6 +24,7 @@ from ..jsinterp import JSInterpreter
from ..utils import (
ExtractorError,
clean_html,
+ dict_get,
float_or_none,
int_or_none,
mimetype2ext,
@@ -2541,13 +2542,14 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
continuation = self._extract_continuation(continuation_renderer)
continue
+ on_response_received = dict_get(response, ('onResponseReceivedActions', 'onResponseReceivedEndpoints'))
continuation_items = try_get(
- response, lambda x: x['onResponseReceivedActions'][0]['appendContinuationItemsAction']['continuationItems'], list)
+ on_response_received, lambda x: x[0]['appendContinuationItemsAction']['continuationItems'], list)
if continuation_items:
continuation_item = continuation_items[0]
if not isinstance(continuation_item, dict):
continue
- renderer = continuation_item.get('gridVideoRenderer')
+ renderer = self._extract_grid_item_renderer(continuation_item)
if renderer:
grid_renderer = {'items': continuation_items}
for entry in self._grid_entries(grid_renderer):
@@ -2561,6 +2563,13 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
yield entry
continuation = self._extract_continuation(video_list_renderer)
continue
+ renderer = continuation_item.get('backstagePostThreadRenderer')
+ if renderer:
+ continuation_renderer = {'contents': continuation_items}
+ for entry in self._post_thread_continuation_entries(continuation_renderer):
+ yield entry
+ continuation = self._extract_continuation(continuation_renderer)
+ continue
break