mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-16 01:39:38 +01:00
parent
e37d0efbd9
commit
9c0d7f4951
@ -39,6 +39,7 @@
|
|||||||
int_or_none,
|
int_or_none,
|
||||||
intlist_to_bytes,
|
intlist_to_bytes,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
|
network_exceptions,
|
||||||
orderedSet,
|
orderedSet,
|
||||||
parse_codecs,
|
parse_codecs,
|
||||||
parse_count,
|
parse_count,
|
||||||
@ -760,12 +761,15 @@ def _extract_response(self, item_id, query, note='Downloading API JSON', headers
|
|||||||
api_hostname=api_hostname, default_client=default_client,
|
api_hostname=api_hostname, default_client=default_client,
|
||||||
note='%s%s' % (note, ' (retry #%d)' % count if count else ''))
|
note='%s%s' % (note, ' (retry #%d)' % count if count else ''))
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if isinstance(e.cause, compat_HTTPError) and e.cause.code in (500, 503, 404):
|
if isinstance(e.cause, network_exceptions):
|
||||||
# Downloading page may result in intermittent 5xx HTTP error
|
# Downloading page may result in intermittent 5xx HTTP error
|
||||||
# Sometimes a 404 is also recieved. See: https://github.com/ytdl-org/youtube-dl/issues/28289
|
# Sometimes a 404 is also recieved. See: https://github.com/ytdl-org/youtube-dl/issues/28289
|
||||||
last_error = 'HTTP Error %s' % e.cause.code
|
# We also want to catch all other network exceptions since errors in later pages can be troublesome
|
||||||
if count < retries:
|
# See https://github.com/yt-dlp/yt-dlp/issues/507#issuecomment-880188210
|
||||||
continue
|
if not isinstance(e.cause, compat_HTTPError) or e.cause.code not in (403, 429):
|
||||||
|
last_error = error_to_compat_str(e.cause or e)
|
||||||
|
if count < retries:
|
||||||
|
continue
|
||||||
if fatal:
|
if fatal:
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user