fix proxy
This commit is contained in:
parent
69e4448db7
commit
482877e5c6
@ -85,8 +85,7 @@ def get_proxy_url(proxy, current, path):
|
||||
presp = requests.post(proxy_server, json=data)
|
||||
return presp.text
|
||||
|
||||
def rewrite(current, provider):
|
||||
proxy = proxies.get(provider)
|
||||
def rewrite(current, provider, proxy):
|
||||
resp = requests.head(current, proxies=proxy.req)
|
||||
ctype = resp.headers.get("Content-Type")
|
||||
if ctype is None:
|
||||
@ -168,7 +167,6 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
if provider == "youtube":
|
||||
path = path.strip("/")
|
||||
src = providers[provider] + self.request.path
|
||||
proxy = None
|
||||
proxy_list = None
|
||||
proxy_list_orig = proxies.get(provider)
|
||||
if isinstance(proxy_list_orig, list):
|
||||
@ -200,7 +198,7 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
if write:
|
||||
self.write("Stream not found.")
|
||||
else:
|
||||
data = rewrite(upstream, provider)
|
||||
data = rewrite(upstream, provider, proxy)
|
||||
if data is None:
|
||||
self.redirect(upstream, status=303)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user