diff --git a/stream.py b/stream.py index cd429fa..775c3da 100755 --- a/stream.py +++ b/stream.py @@ -200,6 +200,7 @@ class MainHandler(tornado.web.RequestHandler): streams = proxy.stream.streams(src) for key in reversed(streams): stream = streams.get(key) + print(stream) if hasattr(stream, "url"): upstream = stream.url break @@ -220,11 +221,14 @@ class MainHandler(tornado.web.RequestHandler): ldata["proxy"] = proxy.proxy ldata["proxied"] = isinstance(proxy.proxy, str) links = [ldata] - resp = requests.post(proxy_server, json=links) - if isinstance(resp.text, str): - new_links = json.loads(resp.text) - if isinstance(new_links, list) and len(new_links) == 1: - upstream = new_links.pop() + try: + resp = requests.post(proxy_server, json=links) + if isinstance(resp.text, str): + new_links = json.loads(resp.text) + if isinstance(new_links, list) and len(new_links) == 1: + upstream = new_links.pop() + except Exception as e: + print(e) if data is None: self.redirect(upstream, status=303) else: