diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-03-07 10:57:45 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-03-07 11:04:55 +0530 |
commit | 26fe8ffed0a245c66732096dd0a01ee2cf04f04b (patch) | |
tree | f62a80573701250d482f751320a61b130e402731 | |
parent | feee67ae881b623c9fe4e35d9a6c7879c98bab19 (diff) | |
download | hypervideo-pre-26fe8ffed0a245c66732096dd0a01ee2cf04f04b.tar.lz hypervideo-pre-26fe8ffed0a245c66732096dd0a01ee2cf04f04b.tar.xz hypervideo-pre-26fe8ffed0a245c66732096dd0a01ee2cf04f04b.zip |
[youtube] Fix community page continuation (Closes #152)
-rw-r--r-- | yt_dlp/extractor/youtube.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 3a56f2a42..27eb8aaae 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -26,6 +26,7 @@ from ..compat import ( from ..jsinterp import JSInterpreter from ..utils import ( clean_html, + dict_get, ExtractorError, format_field, float_or_none, @@ -2797,7 +2798,8 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor): else: # Youtube sometimes sends incomplete data # See: https://github.com/ytdl-org/youtube-dl/issues/28194 - if response.get('continuationContents') or response.get('onResponseReceivedActions'): + if dict_get(response, + ('continuationContents', 'onResponseReceivedActions', 'onResponseReceivedEndpoints')): break # Youtube may send alerts if there was an issue with the continuation page @@ -2837,9 +2839,11 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor): 'playlistVideoRenderer': (self._playlist_entries, 'contents'), 'itemSectionRenderer': (extract_entries, 'contents'), # for feeds 'richItemRenderer': (extract_entries, 'contents'), # for hashtag + 'backstagePostThreadRenderer': (self._post_thread_continuation_entries, 'contents') } continuation_items = try_get( - response, lambda x: x['onResponseReceivedActions'][0]['appendContinuationItemsAction']['continuationItems'], list) + response, + lambda x: dict_get(x, ('onResponseReceivedActions', 'onResponseReceivedEndpoints'))[0]['appendContinuationItemsAction']['continuationItems'], list) continuation_item = try_get(continuation_items, lambda x: x[0], dict) or {} video_items_renderer = None for key, value in continuation_item.items(): |