aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M. <dstftw@gmail.com>2015-09-05 02:19:41 +0600
committerSergey M. <dstftw@gmail.com>2015-09-05 02:19:41 +0600
commit52c6f26cabf1fb94fe6fb384402cebc6b29c3f93 (patch)
tree8a63c44a2095d6ff4664921036255ea7466589fc
parentc482b3c69aac9069a8c1acb1f2b60d6578331461 (diff)
parentdc534b674f9dfbe869d23f6a64ea48f39bde6655 (diff)
downloadyoutube-dl-52c6f26cabf1fb94fe6fb384402cebc6b29c3f93.tar.xz
Merge pull request #6755 from remitamine/external_downloader_options
[downloader/external] Respect --no-check-certificate for curl and aria2c and --proxy for curl
-rw-r--r--youtube_dl/downloader/external.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py
index 6c310346c..056215f8c 100644
--- a/youtube_dl/downloader/external.py
+++ b/youtube_dl/downloader/external.py
@@ -49,10 +49,20 @@ class ExternalFD(FileDownloader):
param = self.params.get(param)
if param is None:
return []
- if isinstance(param, bool):
- return [command_option]
return [command_option, param]
+ def _bool_option(self, command_option, param, true_value='true', false_value='false', separator=None):
+ param = self.params.get(param)
+ if not isinstance(param, bool):
+ return []
+ if separator:
+ return [command_option + separator + (true_value if param else false_value)]
+ return [command_option, true_value if param else false_value]
+
+ def _valueless_option(self, command_option, param, expected_value=True):
+ param = self.params.get(param)
+ return [command_option] if param == expected_value else []
+
def _configuration_args(self, default=[]):
ex_args = self.params.get('external_downloader_args')
if ex_args is None:
@@ -80,6 +90,8 @@ class CurlFD(ExternalFD):
for key, val in info_dict['http_headers'].items():
cmd += ['--header', '%s: %s' % (key, val)]
cmd += self._option('--interface', 'source_address')
+ cmd += self._option('--proxy', 'proxy')
+ cmd += self._valueless_option('--insecure', 'nocheckcertificate')
cmd += self._configuration_args()
cmd += ['--', info_dict['url']]
return cmd
@@ -102,7 +114,7 @@ class WgetFD(ExternalFD):
cmd += ['--header', '%s: %s' % (key, val)]
cmd += self._option('--bind-address', 'source_address')
cmd += self._option('--proxy', 'proxy')
- cmd += self._option('--no-check-certificate', 'nocheckcertificate')
+ cmd += self._valueless_option('--no-check-certificate', 'nocheckcertificate')
cmd += self._configuration_args()
cmd += ['--', info_dict['url']]
return cmd
@@ -121,6 +133,7 @@ class Aria2cFD(ExternalFD):
cmd += ['--header', '%s: %s' % (key, val)]
cmd += self._option('--interface', 'source_address')
cmd += self._option('--all-proxy', 'proxy')
+ cmd += self._bool_option('--check-certificate', 'nocheckcertificate', 'false', 'true', '=')
cmd += ['--', info_dict['url']]
return cmd