From 0588fb301cc76d306ab2b9c15003c01a067e7340 Mon Sep 17 00:00:00 2001 From: Roy Olav Purser Date: Wed, 26 May 2021 19:40:31 +0200 Subject: [PATCH] get hls from proxy --- backend/stream.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/stream.py b/backend/stream.py index 6ba586d..7195076 100755 --- a/backend/stream.py +++ b/backend/stream.py @@ -281,13 +281,12 @@ try: except Exception as e: logger.info(e) -async def rewrite(current, proxy): +async def rewrite(upstream, current, proxy): ndata = None text = None try: async with proxy.session() as session: - logger.info(current) - resp = await session.get(current) + resp = await session.get(upstream) text = await resp.text() logger.info(text) except Exception as e: @@ -386,7 +385,7 @@ class MainHandler(tornado.web.RequestHandler): ctype = await handler.proxy.content_type(upstream_proxy) data = None if "mpegurl" in ctype.lower(): - data = await rewrite(upstream, handler.proxy) + data = await rewrite(upstream_proxy, upstream, handler.proxy) if isinstance(data, str): self.set_header("Content-Type", "application/vnd.apple.mpegurl") self.write(data)