站点独立设置超时时间

This commit is contained in:
jxxghp
2024-05-16 14:42:10 +08:00
parent 43647e59a4
commit 3088bbb2f8
7 changed files with 22 additions and 12 deletions

View File

@ -17,11 +17,13 @@ class TorrentLeech:
_browseurl = "%storrents/browse/list/page/2%s"
_downloadurl = "%sdownload/%s/%s"
_pageurl = "%storrent/%s"
_timeout = 15
def __init__(self, indexer: CommentedMap):
self._indexer = indexer
if indexer.get('proxy'):
self._proxy = settings.PROXY
self._timeout = indexer.get('timeout') or 15
def search(self, keyword: str, page: int = 0) -> Tuple[bool, List[dict]]:
@ -40,7 +42,7 @@ class TorrentLeech:
},
cookies=self._indexer.get('cookie'),
proxies=self._proxy,
timeout=15
timeout=self._timeout
).get_res(url)
torrents = []
if res and res.status_code == 200: