jxxghp
2024-11-07 18:58:32 +08:00
parent 2aadbeaed7
commit 28f6e7f9bb
+4 -2
View File
@@ -225,12 +225,13 @@ class RssHelper:
} }
@staticmethod @staticmethod
def parse(url, proxy: bool = False, timeout: int = 15) -> Union[List[dict], None]: def parse(url, proxy: bool = False, timeout: int = 15, headers: dict = None) -> Union[List[dict], None]:
""" """
解析RSS订阅URL,获取RSS中的种子信息 解析RSS订阅URL,获取RSS中的种子信息
:param url: RSS地址 :param url: RSS地址
:param proxy: 是否使用代理 :param proxy: 是否使用代理
:param timeout: 请求超时 :param timeout: 请求超时
:param headers: 自定义请求头
:return: 种子信息列表,如为None代表Rss过期 :return: 种子信息列表,如为None代表Rss过期
""" """
# 开始处理 # 开始处理
@@ -238,7 +239,8 @@ class RssHelper:
if not url: if not url:
return [] return []
try: try:
ret = RequestUtils(proxies=settings.PROXY if proxy else None, timeout=timeout).get_res(url) ret = RequestUtils(proxies=settings.PROXY if proxy else None,
timeout=timeout, headers=headers).get_res(url)
if not ret: if not ret:
return [] return []
except Exception as err: except Exception as err: