Merge pull request #1464 from cikezhu/main

让自定义站点可自行设置: 搜索结果条数/请求超时
This commit is contained in:
jxxghp
2024-02-10 11:30:25 +08:00
committed by GitHub
3 changed files with 12 additions and 6 deletions

View File

@ -225,11 +225,12 @@ class RssHelper:
}
@staticmethod
def parse(url, proxy: bool = False) -> Union[List[dict], None]:
def parse(url, proxy: bool = False, timeout: int = 30) -> Union[List[dict], None]:
"""
解析RSS订阅URL获取RSS中的种子信息
:param url: RSS地址
:param proxy: 是否使用代理
:param timeout: 请求超时
:return: 种子信息列表如为None代表Rss过期
"""
# 开始处理
@ -237,7 +238,7 @@ class RssHelper:
if not url:
return []
try:
ret = RequestUtils(proxies=settings.PROXY if proxy else None).get_res(url)
ret = RequestUtils(proxies=settings.PROXY if proxy else None, timeout=timeout).get_res(url)
if not ret:
return []
except Exception as err: