1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2025-01-30 22:59:48 +00:00

Add and implement --client-certificate option

Use a PEM certificate to authenticate HTTPS access to site
This commit is contained in:
df 2021-07-14 16:51:24 +01:00
parent a803582717
commit a67dafe3aa
3 changed files with 9 additions and 0 deletions

View File

@ -320,6 +320,7 @@ def _real_main(argv=None):
'password': opts.password, 'password': opts.password,
'twofactor': opts.twofactor, 'twofactor': opts.twofactor,
'videopassword': opts.videopassword, 'videopassword': opts.videopassword,
'clientcertificate': opts.clientcertificate,
'ap_mso': opts.ap_mso, 'ap_mso': opts.ap_mso,
'ap_username': opts.ap_username, 'ap_username': opts.ap_username,
'ap_password': opts.ap_password, 'ap_password': opts.ap_password,

View File

@ -370,6 +370,10 @@ def parseOpts(overrideArguments=None):
'--video-password', '--video-password',
dest='videopassword', metavar='PASSWORD', dest='videopassword', metavar='PASSWORD',
help='Video password (vimeo, youku)') 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 = optparse.OptionGroup(parser, 'Adobe Pass Options')
adobe_pass.add_option( adobe_pass.add_option(

View File

@ -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) # https://github.com/ytdl-org/youtube-dl/issues/6727)
if sys.version_info < (3, 0): if sys.version_info < (3, 0):
kwargs['strict'] = True 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)) hc = http_class(*args, **compat_kwargs(kwargs))
source_address = ydl_handler._params.get('source_address') source_address = ydl_handler._params.get('source_address')