diff options
author | coletdjnz <coletdjnz@protonmail.com> | 2023-07-15 15:20:24 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-15 03:20:24 +0000 |
commit | 1ba6fe9db5f660d5538588315c23ad6cf0371c5f (patch) | |
tree | 549474613a2e9ec1b51489b78369213cdb839418 | |
parent | 1bcb9fe8715b1f288efc322be3de409ee0597080 (diff) | |
download | hypervideo-pre-1ba6fe9db5f660d5538588315c23ad6cf0371c5f.tar.lz hypervideo-pre-1ba6fe9db5f660d5538588315c23ad6cf0371c5f.tar.xz hypervideo-pre-1ba6fe9db5f660d5538588315c23ad6cf0371c5f.zip |
[ie/youtube:tab] Detect looping feeds (#6621)
Closes https://github.com/yt-dlp/yt-dlp/issues/5555
Note: the first page may still be repeated, however this is better than nothing.
Authored by: coletdjnz
-rw-r--r-- | yt_dlp/extractor/youtube.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 73bfa662d..826bbb20e 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -4921,10 +4921,15 @@ class YoutubeTabBaseInfoExtractor(YoutubeBaseInfoExtractor): or try_get(tab_content, lambda x: x['richGridRenderer'], dict) or {}) yield from extract_entries(parent_renderer) continuation = continuation_list[0] - + seen_continuations = set() for page_num in itertools.count(1): if not continuation: break + continuation_token = continuation.get('continuation') + if continuation_token is not None and continuation_token in seen_continuations: + self.write_debug('Detected YouTube feed looping - assuming end of feed.') + break + seen_continuations.add(continuation_token) headers = self.generate_api_headers( ytcfg=ytcfg, account_syncid=account_syncid, visitor_data=visitor_data) response = self._extract_response( |