retry content type through proxy
This commit is contained in:
		@@ -223,7 +223,15 @@ class MainHandler(tornado.web.RequestHandler):
 | 
			
		||||
            video_info = {}
 | 
			
		||||
            video_info["upstream"] = proxied[0]
 | 
			
		||||
            video_info["poster"] = proxied[1]
 | 
			
		||||
            video_info["ctype"] = provider_data.ctype()
 | 
			
		||||
 | 
			
		||||
            if isinstance(provider_data.ctype(), str):
 | 
			
		||||
                video_info["ctype"] = provider_data.ctype()
 | 
			
		||||
            else:
 | 
			
		||||
                async with handler.proxy.local() as session:
 | 
			
		||||
                    resp = await session.head(proxied[0])
 | 
			
		||||
                    ctype = resp.headers.get("Content-Type", None)
 | 
			
		||||
                    if isinstance(ctype, str):
 | 
			
		||||
                        video_info["ctype"] = ctype
 | 
			
		||||
 | 
			
		||||
            script = template_script.generate(info=json.dumps(video_info))
 | 
			
		||||
            b64 = str(base64.b64encode(script), "ascii")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user