retry content type through proxy

This commit is contained in:
Roy Olav Purser 2021-06-03 16:10:12 +02:00
parent d3808c43f8
commit f8e4fb255b
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -223,7 +223,15 @@ class MainHandler(tornado.web.RequestHandler):
video_info = {}
video_info["upstream"] = proxied[0]
video_info["poster"] = proxied[1]
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")