[youtube] Fix error reporting of "Incomplete data"

Related: #4669
This commit is contained in:
pukkandan 2022-08-16 22:01:48 +05:30
parent c200096c03
commit 3ce2933693
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
2 changed files with 2 additions and 2 deletions

View file

@ -809,7 +809,7 @@ def _extract_response(self, item_id, query, note='Downloading API JSON', headers
# Youtube sometimes sends incomplete data # Youtube sometimes sends incomplete data
# See: https://github.com/ytdl-org/youtube-dl/issues/28194 # See: https://github.com/ytdl-org/youtube-dl/issues/28194
if not traverse_obj(response, *variadic(check_get_keys)): if not traverse_obj(response, *variadic(check_get_keys)):
retry.error = ExtractorError('Incomplete data received') retry.error = ExtractorError('Incomplete data received', expected=True)
continue continue
return response return response

View file

@ -5764,7 +5764,7 @@ def report_retry(e, count, retries, *, sleep_func, info, warn, error=None, suffi
if not count: if not count:
return warn(e) return warn(e)
elif isinstance(e, ExtractorError): elif isinstance(e, ExtractorError):
e = remove_end(str(e.cause) or e.orig_msg, '.') e = remove_end(str_or_none(e.cause) or e.orig_msg, '.')
warn(f'{e}. Retrying{format_field(suffix, None, " %s")} ({count}/{retries})...') warn(f'{e}. Retrying{format_field(suffix, None, " %s")} ({count}/{retries})...')
delay = float_or_none(sleep_func(n=count - 1)) if callable(sleep_func) else sleep_func delay = float_or_none(sleep_func(n=count - 1)) if callable(sleep_func) else sleep_func