diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index e1bd67919..d43155993 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -320,6 +320,7 @@ def _real_main(argv=None): 'password': opts.password, 'twofactor': opts.twofactor, 'videopassword': opts.videopassword, + 'clientcertificate': opts.clientcertificate, 'ap_mso': opts.ap_mso, 'ap_username': opts.ap_username, 'ap_password': opts.ap_password, diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 0a0641bd4..399160c2f 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -370,6 +370,10 @@ def parseOpts(overrideArguments=None): '--video-password', dest='videopassword', metavar='PASSWORD', help='Video password (vimeo, youku)') + authentication.add_option( + '--client-certificate', + dest='clientcertificate', metavar='PATH', + help='Path to a single certificate file in PEM format, used to authenticate to the site') adobe_pass = optparse.OptionGroup(parser, 'Adobe Pass Options') adobe_pass.add_option( diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index e722eed58..ff31d570f 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -2477,6 +2477,10 @@ def _create_http_connection(ydl_handler, http_class, is_https, *args, **kwargs): # https://github.com/ytdl-org/youtube-dl/issues/6727) if sys.version_info < (3, 0): kwargs['strict'] = True + if is_https: + client_cert_path = ydl_handler._params.get('clientcertificate') + if client_cert_path: + kwargs['cert_file'] = client_cert_path hc = http_class(*args, **compat_kwargs(kwargs)) source_address = ydl_handler._params.get('source_address')