diff --git a/stream.py b/stream.py index d5395d6..d81e10b 100755 --- a/stream.py +++ b/stream.py @@ -327,12 +327,15 @@ class MainHandler(tornado.web.RequestHandler): async def handle_stream(self, handler, redir): upstream = None - try: - logger.info(handler.proxy) - streams = handler.proxy.stream().streams(handler.upstream) - except Exception as e: - logger.info(e) - else: + streams = None + for i in range(5): + try: + streams = handler.proxy.stream().streams(handler.upstream) + except Exception as e: + logger.info(e) + else: + break + if streams is not None: for key in reversed(streams): stream = streams.get(key) if hasattr(stream, "url"):