aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcoletdjnz <coletdjnz@protonmail.com>2023-07-03 10:47:10 +0000
committerGitHub <noreply@github.com>2023-07-03 10:47:10 +0000
commit4dc4d8473c085900edc841c87c20041233d25b1f (patch)
treea89683b6d0bb40792266b97dc2d5e34d892e403c
parent8776349ef6b1f644584a92dfa00a05208a48edc4 (diff)
downloadhypervideo-pre-4dc4d8473c085900edc841c87c20041233d25b1f.tar.lz
hypervideo-pre-4dc4d8473c085900edc841c87c20041233d25b1f.tar.xz
hypervideo-pre-4dc4d8473c085900edc841c87c20041233d25b1f.zip
[extractor/youtube] Ignore incomplete data for comment threads by default (#7475)
For both `--ignore-errors` and `--ignore-errors only_download`. Pass `--no-ignore-errors` to not ignore. Closes https://github.com/yt-dlp/yt-dlp/issues/7474 Authored by: coletdjnz
-rw-r--r--yt_dlp/extractor/youtube.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index 967914c0f..2c64f8e84 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -3426,7 +3426,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
# Pinned comments may appear a second time in newest first sort
# See: https://github.com/yt-dlp/yt-dlp/issues/6712
continue
- self.report_warning('Detected YouTube comments looping. Stopping comment extraction as we probably cannot get any more.')
+ self.report_warning(
+ 'Detected YouTube comments looping. Stopping comment extraction '
+ f'{"for this thread" if parent else ""} as we probably cannot get any more.')
yield
else:
tracker['seen_comment_ids'].add(comment['id'])
@@ -3517,12 +3519,18 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
# Ignore incomplete data error for replies if retries didn't work.
# This is to allow any other parent comments and comment threads to be downloaded.
# See: https://github.com/yt-dlp/yt-dlp/issues/4669
- if 'incomplete data' in str(e).lower() and parent and self.get_param('ignoreerrors') is True:
- self.report_warning(
- 'Received incomplete data for a comment reply thread and retrying did not help. '
- 'Ignoring to let other comments be downloaded.')
- else:
- raise
+ if 'incomplete data' in str(e).lower() and parent:
+ if self.get_param('ignoreerrors') in (True, 'only_download'):
+ self.report_warning(
+ 'Received incomplete data for a comment reply thread and retrying did not help. '
+ 'Ignoring to let other comments be downloaded. Pass --no-ignore-errors to not ignore.')
+ return
+ else:
+ raise ExtractorError(
+ 'Incomplete data received for comment reply thread. '
+ 'Pass --ignore-errors to ignore and allow rest of comments to download.',
+ expected=True)
+ raise
is_forced_continuation = False
continuation = None
for continuation_items in traverse_obj(response, continuation_items_path, expected_type=list, default=[]):