check for empty proxy
This commit is contained in:
parent
3ccbef047e
commit
462a3dbbc5
@ -200,6 +200,7 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
streams = proxy.stream.streams(src)
|
streams = proxy.stream.streams(src)
|
||||||
for key in reversed(streams):
|
for key in reversed(streams):
|
||||||
stream = streams.get(key)
|
stream = streams.get(key)
|
||||||
|
print(stream)
|
||||||
if hasattr(stream, "url"):
|
if hasattr(stream, "url"):
|
||||||
upstream = stream.url
|
upstream = stream.url
|
||||||
break
|
break
|
||||||
@ -220,11 +221,14 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
ldata["proxy"] = proxy.proxy
|
ldata["proxy"] = proxy.proxy
|
||||||
ldata["proxied"] = isinstance(proxy.proxy, str)
|
ldata["proxied"] = isinstance(proxy.proxy, str)
|
||||||
links = [ldata]
|
links = [ldata]
|
||||||
|
try:
|
||||||
resp = requests.post(proxy_server, json=links)
|
resp = requests.post(proxy_server, json=links)
|
||||||
if isinstance(resp.text, str):
|
if isinstance(resp.text, str):
|
||||||
new_links = json.loads(resp.text)
|
new_links = json.loads(resp.text)
|
||||||
if isinstance(new_links, list) and len(new_links) == 1:
|
if isinstance(new_links, list) and len(new_links) == 1:
|
||||||
upstream = new_links.pop()
|
upstream = new_links.pop()
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
if data is None:
|
if data is None:
|
||||||
self.redirect(upstream, status=303)
|
self.redirect(upstream, status=303)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user