aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-05-04 22:36:18 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-05-04 22:36:18 +0530
commit3158150cb758f4b0a582a2bccf2bc88385e27a27 (patch)
tree2eccfc9b5ac0ad9a83cc52ddbd582e0122c8cefc /yt_dlp/utils.py
parent6ef6bcbd6bf413340f4ea232780e504f6598b7e9 (diff)
downloadhypervideo-pre-3158150cb758f4b0a582a2bccf2bc88385e27a27.tar.lz
hypervideo-pre-3158150cb758f4b0a582a2bccf2bc88385e27a27.tar.xz
hypervideo-pre-3158150cb758f4b0a582a2bccf2bc88385e27a27.zip
[utils] Add `network_exceptions`
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r--yt_dlp/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index eb266dda7..08e2d19d2 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -2361,6 +2361,12 @@ class YoutubeDLError(Exception):
pass
+network_exceptions = [compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error]
+if hasattr(ssl, 'CertificateError'):
+ network_exceptions.append(ssl.CertificateError)
+network_exceptions = tuple(network_exceptions)
+
+
class ExtractorError(YoutubeDLError):
"""Error during info extraction."""
@@ -2369,7 +2375,7 @@ class ExtractorError(YoutubeDLError):
If expected is set, this is a normal error message and most likely not a bug in yt-dlp.
"""
- if sys.exc_info()[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError):
+ if sys.exc_info()[0] in network_exceptions:
expected = True
if video_id is not None:
msg = video_id + ': ' + msg