[letv] Add --cn-verification-proxy (Closes #5077)

This commit is contained in:
Philipp Hagemeister 2015-03-03 00:03:06 +01:00
parent a7440261c5
commit 91410c9bfa
5 changed files with 49 additions and 7 deletions

View file

@ -1768,3 +1768,13 @@ def match_filter_func(filter_str):
video_title = info_dict.get('title', info_dict.get('id', 'video'))
return '%s does not pass filter %s, skipping ..' % (video_title, filter_str)
return _match_func
class PerRequestProxyHandler(compat_urllib_request.ProxyHandler):
def proxy_open(self, req, proxy, type):
req_proxy = req.headers.get('Ytdl-Request-Proxy')
if req_proxy is not None:
proxy = req_proxy
del req.headers['Ytdl-Request-Proxy']
return compat_urllib_request.ProxyHandler.proxy_open(
self, req, proxy, type)