让自定义站点可自行设置: 搜索结果条数/请求超时

This commit is contained in:
叮叮当
2024-02-09 22:45:58 +08:00
parent 7350216fc4
commit dde3b76573
3 changed files with 12 additions and 6 deletions

View File

@ -224,11 +224,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过期
"""
# 开始处理
@ -236,7 +237,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: