get hls from proxy
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user