aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew <coletdjnz@protonmail.com>2022-11-10 19:35:22 +1300
committerGitHub <noreply@github.com>2022-11-10 06:35:22 +0000
commite72e48c53f16771ea7d786deb6b65a40d82a14c4 (patch)
treef3fb45a1896f3854c9d8a75def3e47311d30a236
parent0cf643b234ff2f4d017a980dbaefdb14ed6e4db6 (diff)
downloadhypervideo-pre-e72e48c53f16771ea7d786deb6b65a40d82a14c4.tar.lz
hypervideo-pre-e72e48c53f16771ea7d786deb6b65a40d82a14c4.tar.xz
hypervideo-pre-e72e48c53f16771ea7d786deb6b65a40d82a14c4.zip
[extractor/youtube] Ignore incomplete data error for comment replies (#5490)
When --ignore-errors is used. Closes https://github.com/yt-dlp/yt-dlp/issues/4669 Authored by: coletdjnz
-rw-r--r--yt_dlp/extractor/youtube.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index 5b7c94c4e..5b39f9765 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -3237,11 +3237,21 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
note_prefix = '%sDownloading comment%s API JSON page %d %s' % (
' ' if parent else '', ' replies' if parent else '',
page_num, comment_prog_str)
-
- response = self._extract_response(
- item_id=None, query=continuation,
- ep='next', ytcfg=ytcfg, headers=headers, note=note_prefix,
- check_get_keys='onResponseReceivedEndpoints' if not is_forced_continuation else None)
+ try:
+ response = self._extract_response(
+ item_id=None, query=continuation,
+ ep='next', ytcfg=ytcfg, headers=headers, note=note_prefix,
+ check_get_keys='onResponseReceivedEndpoints' if not is_forced_continuation else None)
+ except ExtractorError as e:
+ # 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
is_forced_continuation = False
continuation_contents = traverse_obj(
response, 'onResponseReceivedEndpoints', expected_type=list, default=[])