increase local timeout
This commit is contained in:
parent
f8e4fb255b
commit
48c666f133
@ -37,7 +37,7 @@ class ProxyElem():
|
||||
def __init__(self, proxy):
|
||||
self.proxy = proxy
|
||||
def local(self):
|
||||
timeout = aiohttp.ClientTimeout(total=1)
|
||||
timeout = aiohttp.ClientTimeout(total=5)
|
||||
return aiohttp.ClientSession(timeout=timeout)
|
||||
def session(self):
|
||||
connector = None
|
||||
@ -227,11 +227,14 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
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
|
||||
try:
|
||||
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
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
|
||||
script = template_script.generate(info=json.dumps(video_info))
|
||||
b64 = str(base64.b64encode(script), "ascii")
|
||||
|
Loading…
Reference in New Issue
Block a user