diff options
author | xtkoba <69125751+xtkoba@users.noreply.github.com> | 2022-01-21 15:12:30 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-21 11:42:30 +0530 |
commit | f81c62a6a42ac0192fa0634c225ee540ad73be5a (patch) | |
tree | 298e4971820195190b9df4f777690c77d327cdef | |
parent | 6c73052c0a44c90dad22468d598e1bc6aba7534c (diff) | |
download | hypervideo-pre-f81c62a6a42ac0192fa0634c225ee540ad73be5a.tar.lz hypervideo-pre-f81c62a6a42ac0192fa0634c225ee540ad73be5a.tar.xz hypervideo-pre-f81c62a6a42ac0192fa0634c225ee540ad73be5a.zip |
Add option --legacy-server-connect (#778)
to allow HTTPS connection to servers that do not support RFC 5746 secure renegotiation
Authored by: xtkoba
-rw-r--r-- | yt_dlp/YoutubeDL.py | 2 | ||||
-rw-r--r-- | yt_dlp/__init__.py | 1 | ||||
-rw-r--r-- | yt_dlp/options.py | 4 | ||||
-rw-r--r-- | yt_dlp/utils.py | 2 |
4 files changed, 9 insertions, 0 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 21edfe339..27fcc2a81 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -323,6 +323,8 @@ class YoutubeDL(object): cookiesfrombrowser: A tuple containing the name of the browser, the profile name/pathfrom where cookies are loaded, and the name of the keyring. Eg: ('chrome', ) or ('vivaldi', 'default', 'BASICTEXT') + legacyserverconnect: Explicitly allow HTTPS connection to servers that do not + support RFC 5746 secure renegotiation nocheckcertificate: Do not verify SSL certificates prefer_insecure: Use HTTP instead of HTTPS to retrieve information. At the moment, this is only supported by YouTube. diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py index f3faf0ce4..c5e647c23 100644 --- a/yt_dlp/__init__.py +++ b/yt_dlp/__init__.py @@ -756,6 +756,7 @@ def _real_main(argv=None): 'skip_playlist_after_errors': opts.skip_playlist_after_errors, 'cookiefile': opts.cookiefile, 'cookiesfrombrowser': opts.cookiesfrombrowser, + 'legacyserverconnect': opts.legacy_server_connect, 'nocheckcertificate': opts.no_check_certificate, 'prefer_insecure': opts.prefer_insecure, 'proxy': opts.proxy, diff --git a/yt_dlp/options.py b/yt_dlp/options.py index cb6f01d4d..50a70c12c 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -828,6 +828,10 @@ def create_parser(): dest='encoding', metavar='ENCODING', help='Force the specified encoding (experimental)') workarounds.add_option( + '--legacy-server-connect', + action='store_true', dest='legacy_server_connect', default=False, + help='Explicitly allow HTTPS connection to servers that do not support RFC 5746 secure renegotiation') + workarounds.add_option( '--no-check-certificates', action='store_true', dest='no_check_certificate', default=False, help='Suppress HTTPS certificate validation') diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 0defe83e8..cb44a9c51 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -997,6 +997,8 @@ def make_HTTPS_handler(params, **kwargs): opts_check_certificate = not params.get('nocheckcertificate') context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.check_hostname = opts_check_certificate + if params.get('legacyserverconnect'): + context.options |= 4 # SSL_OP_LEGACY_SERVER_CONNECT context.verify_mode = ssl.CERT_REQUIRED if opts_check_certificate else ssl.CERT_NONE if opts_check_certificate: try: |