[YoutubeDL] Rename alternative proxy to China verification proxy

Documentations are updated as well to make the purpose of the new
option more clear
This commit is contained in:
Yen Chi Hsuan 2015-03-01 18:54:10 +08:00
parent 63367c442b
commit 3981ef4c2a
3 changed files with 10 additions and 9 deletions

View File

@ -1721,7 +1721,7 @@ class YoutubeDL(object):
self._write_string('[debug] exe versions: %s\n' % exe_str) self._write_string('[debug] exe versions: %s\n' % exe_str)
self.dump_proxy_map('default', 'Proxy map') 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): if self.params.get('call_home', False):
ipaddr = self.urlopen('https://yt-dl.org/ip').read().decode('utf-8') 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) ydlh = YoutubeDLHandler(self.params, debuglevel=debuglevel)
default_proxy = self.params.get('proxy') default_proxy = self.params.get('proxy')
alternative_proxy = self.params.get('alternative_proxy') cn_verification_proxy = self.params.get('cn_verification_proxy')
if not alternative_proxy:
alternative_proxy = default_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('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): def _setup_single_opener(self, opener_name, opts_proxy, https_handler, ydlh):
cookie_processor = compat_urllib_request.HTTPCookieProcessor( cookie_processor = compat_urllib_request.HTTPCookieProcessor(

View File

@ -57,7 +57,7 @@ class LetvIE(InfoExtractor):
'publish time' 'publish time'
], ],
'params': { '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( play_json = self._download_json(
'http://api.letv.com/mms/out/video/playJson?' + compat_urllib_parse.urlencode(params), '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 # Check for errors
playstatus = play_json['playstatus'] playstatus = play_json['playstatus']

View File

@ -177,9 +177,9 @@ def parseOpts(overrideArguments=None):
default=None, metavar='URL', default=None, metavar='URL',
help='Use the specified HTTP/HTTPS proxy. Pass in an empty string (--proxy "") for direct connection') help='Use the specified HTTP/HTTPS proxy. Pass in an empty string (--proxy "") for direct connection')
network.add_option( network.add_option(
'--alternative-proxy', dest='alternative_proxy', '--cn-verification-proxy', dest='cn_verification_proxy',
default=None, metavar='URL', 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( network.add_option(
'--socket-timeout', '--socket-timeout',