From 3981ef4c2a7846217695261a64a0277f037ee447 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Sun, 1 Mar 2015 18:54:10 +0800 Subject: [PATCH] [YoutubeDL] Rename alternative proxy to China verification proxy Documentations are updated as well to make the purpose of the new option more clear --- youtube_dl/YoutubeDL.py | 11 ++++++----- youtube_dl/extractor/letv.py | 4 ++-- youtube_dl/options.py | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index f4db67fae..7b5dca1b1 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -1721,7 +1721,7 @@ class YoutubeDL(object): self._write_string('[debug] exe versions: %s\n' % exe_str) self.dump_proxy_map('default', 'Proxy map') - self.dump_proxy_map('alternative', 'Alternative proxy map') + self.dump_proxy_map('cn_verification', 'China IP verification proxy map') if self.params.get('call_home', False): ipaddr = self.urlopen('https://yt-dl.org/ip').read().decode('utf-8') @@ -1761,12 +1761,13 @@ class YoutubeDL(object): ydlh = YoutubeDLHandler(self.params, debuglevel=debuglevel) default_proxy = self.params.get('proxy') - alternative_proxy = self.params.get('alternative_proxy') - if not alternative_proxy: - alternative_proxy = default_proxy + cn_verification_proxy = self.params.get('cn_verification_proxy') + + if not cn_verification_proxy: + cn_verification_proxy = default_proxy self._setup_single_opener('default', default_proxy, https_handler, ydlh) - self._setup_single_opener('alternative', alternative_proxy, https_handler, ydlh) + self._setup_single_opener('cn_verification', cn_verification_proxy, https_handler, ydlh) def _setup_single_opener(self, opener_name, opts_proxy, https_handler, ydlh): cookie_processor = compat_urllib_request.HTTPCookieProcessor( diff --git a/youtube_dl/extractor/letv.py b/youtube_dl/extractor/letv.py index d9846fda8..bd961b3c7 100644 --- a/youtube_dl/extractor/letv.py +++ b/youtube_dl/extractor/letv.py @@ -57,7 +57,7 @@ class LetvIE(InfoExtractor): 'publish time' ], 'params': { - 'alternative_proxy': 'proxy.uku.im:8888' + 'cn_verification_proxy': 'proxy.uku.im:8888' } }] @@ -94,7 +94,7 @@ class LetvIE(InfoExtractor): play_json = self._download_json( 'http://api.letv.com/mms/out/video/playJson?' + compat_urllib_parse.urlencode(params), - media_id, 'playJson data', opener_name='alternative') + media_id, 'playJson data', opener_name='cn_verification') # Check for errors playstatus = play_json['playstatus'] diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 8cfa7ec7c..1df9654e0 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -177,9 +177,9 @@ def parseOpts(overrideArguments=None): default=None, metavar='URL', help='Use the specified HTTP/HTTPS proxy. Pass in an empty string (--proxy "") for direct connection') network.add_option( - '--alternative-proxy', dest='alternative_proxy', + '--cn-verification-proxy', dest='cn_verification_proxy', default=None, metavar='URL', - help='Use the specified HTTP/HTTPS address as the alternative proxy. Pass in an empty string (--alternative-proxy "") for direct connection' + help='The proxy used in the China IP verification step. The default proxy specified by --proxy is used if this option is not given' ) network.add_option( '--socket-timeout',