diff --git a/backend/stream.py b/backend/stream.py index 5030717..f08a4b8 100755 --- a/backend/stream.py +++ b/backend/stream.py @@ -267,15 +267,17 @@ class MainHandler(tornado.web.RequestHandler): self.write("Stream not found. (invalid upstream)") else: upstream_proxy = await handler.proxy.proxy_url(upstream, None) + logger.info(upstream_proxy) ctype = await handler.proxy.content_type(upstream_proxy) self.set_header("Content-Type", ctype) - if ctype == "application/vnd.apple.mpegurl": - async with handler.proxy.local() as session: - resp = await session.get(upstream_proxy) - data = await resp.read() - self.write(data) - elif redir: - self.redirect(upstream_proxy, status=303) + if redir: + if ctype == "application/vnd.apple.mpegurl": + async with handler.proxy.local() as session: + resp = await session.get(upstream_proxy) + data = await resp.read() + self.write(data) + else: + self.redirect(upstream_proxy, status=303) async def get(self): await self.handle_any(True)