Merge pull request #5100 from Seed680/v2

This commit is contained in:
jxxghp
2025-11-06 18:43:41 +08:00
committed by GitHub
2 changed files with 6 additions and 4 deletions

View File

@@ -228,13 +228,14 @@ class RssHelper:
}
def parse(self, url, proxy: bool = False,
timeout: Optional[int] = 15, headers: dict = None) -> Union[List[dict], None, bool]:
timeout: Optional[int] = 15, headers: dict = None, ua: str = None) -> Union[List[dict], None, bool]:
"""
解析RSS订阅URL获取RSS中的种子信息
:param url: RSS地址
:param proxy: 是否使用代理
:param timeout: 请求超时
:param headers: 自定义请求头
:param ua: 自定义User-Agent
:return: 种子信息列表如为None代表Rss过期如果为False则为错误
"""
# 开始处理
@@ -243,8 +244,9 @@ class RssHelper:
return False
try:
ret = RequestUtils(proxies=settings.PROXY if proxy else None,
timeout=timeout, headers=headers).get_res(url)
ret = RequestUtils(ua=ua,
proxies=settings.PROXY if proxy else None,
timeout=timeout or 30, headers=headers).get_res(url)
if not ret:
logger.error(f"获取RSS失败请求返回空值URL: {url}")
return False