aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcoletdev <coletdjnz@protonmail.com>2022-05-28 15:46:36 +1200
committerGitHub <noreply@github.com>2022-05-28 03:46:36 +0000
commit2c6dcb65fb612fc5bc5c61937bf438d3c473d8d0 (patch)
treea0a3a6d279f0a3ed512ea05b64a835099bd56ec9
parent520876fa09daa62301d602537407b0cfce6c55a1 (diff)
downloadhypervideo-pre-2c6dcb65fb612fc5bc5c61937bf438d3c473d8d0.tar.lz
hypervideo-pre-2c6dcb65fb612fc5bc5c61937bf438d3c473d8d0.tar.xz
hypervideo-pre-2c6dcb65fb612fc5bc5c61937bf438d3c473d8d0.zip
[utils] Send HTTP/1.1 ALPN extension (#3889)
Some servers may reject requests if not sent (e.g. fingerprinting) Fixes #3878 Authored by: coletdjnz
-rw-r--r--yt_dlp/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 9da8bb293..b0300b724 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -948,6 +948,13 @@ def make_HTTPS_handler(params, **kwargs):
password=params.get('client_certificate_password'))
except ssl.SSLError:
raise YoutubeDLError('Unable to load client certificate')
+
+ # Some servers may reject requests if ALPN extension is not sent. See:
+ # https://github.com/python/cpython/issues/85140
+ # https://github.com/yt-dlp/yt-dlp/issues/3878
+ with contextlib.suppress(NotImplementedError):
+ context.set_alpn_protocols(['http/1.1'])
+
return YoutubeDLHTTPSHandler(params, context=context, **kwargs)