increase local timeout
This commit is contained in:
parent
f8e4fb255b
commit
48c666f133
@ -37,7 +37,7 @@ class ProxyElem():
|
|||||||
def __init__(self, proxy):
|
def __init__(self, proxy):
|
||||||
self.proxy = proxy
|
self.proxy = proxy
|
||||||
def local(self):
|
def local(self):
|
||||||
timeout = aiohttp.ClientTimeout(total=1)
|
timeout = aiohttp.ClientTimeout(total=5)
|
||||||
return aiohttp.ClientSession(timeout=timeout)
|
return aiohttp.ClientSession(timeout=timeout)
|
||||||
def session(self):
|
def session(self):
|
||||||
connector = None
|
connector = None
|
||||||
@ -227,11 +227,14 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
if isinstance(provider_data.ctype(), str):
|
if isinstance(provider_data.ctype(), str):
|
||||||
video_info["ctype"] = provider_data.ctype()
|
video_info["ctype"] = provider_data.ctype()
|
||||||
else:
|
else:
|
||||||
async with handler.proxy.local() as session:
|
try:
|
||||||
resp = await session.head(proxied[0])
|
async with handler.proxy.local() as session:
|
||||||
ctype = resp.headers.get("Content-Type", None)
|
resp = await session.head(proxied[0])
|
||||||
if isinstance(ctype, str):
|
ctype = resp.headers.get("Content-Type", None)
|
||||||
video_info["ctype"] = ctype
|
if isinstance(ctype, str):
|
||||||
|
video_info["ctype"] = ctype
|
||||||
|
except Exception as e:
|
||||||
|
logger.info(e)
|
||||||
|
|
||||||
script = template_script.generate(info=json.dumps(video_info))
|
script = template_script.generate(info=json.dumps(video_info))
|
||||||
b64 = str(base64.b64encode(script), "ascii")
|
b64 = str(base64.b64encode(script), "ascii")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user