increase local timeout
This commit is contained in:
		@@ -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:
 | 
				
			||||||
 | 
					                try:
 | 
				
			||||||
                    async with handler.proxy.local() as session:
 | 
					                    async with handler.proxy.local() as session:
 | 
				
			||||||
                        resp = await session.head(proxied[0])
 | 
					                        resp = await session.head(proxied[0])
 | 
				
			||||||
                        ctype = resp.headers.get("Content-Type", None)
 | 
					                        ctype = resp.headers.get("Content-Type", None)
 | 
				
			||||||
                        if isinstance(ctype, str):
 | 
					                        if isinstance(ctype, str):
 | 
				
			||||||
                            video_info["ctype"] = ctype
 | 
					                            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")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user