fix cython type error

This commit is contained in:
jxxghp
2025-03-23 21:39:37 +08:00
parent 740cf12c11
commit f9b0db623d
113 changed files with 812 additions and 779 deletions
+6 -6
View File
@@ -77,8 +77,8 @@ class IndexerModule(_ModuleBase):
def search_torrents(self, site: dict,
keywords: List[str] = None,
mtype: MediaType = None,
cat: str = None,
page: int = 0) -> List[TorrentInfo]:
cat: Optional[str] = None,
page: Optional[int] = 0) -> List[TorrentInfo]:
"""
搜索一个站点
:param site: 站点
@@ -218,10 +218,10 @@ class IndexerModule(_ModuleBase):
@staticmethod
def __spider_search(indexer: dict,
search_word: str = None,
search_word: Optional[str] = None,
mtype: MediaType = None,
cat: str = None,
page: int = 0) -> Tuple[bool, List[dict]]:
cat: Optional[str] = None,
page: Optional[int] = 0) -> Tuple[bool, List[dict]]:
"""
根据关键字搜索单个站点
:param: indexer: 站点配置
@@ -241,7 +241,7 @@ class IndexerModule(_ModuleBase):
return _spider.is_error, _spider.get_torrents()
def refresh_torrents(self, site: dict,
keyword: str = None, cat: str = None, page: int = 0) -> Optional[List[TorrentInfo]]:
keyword: Optional[str] = None, cat: Optional[str] = None, page: Optional[int] = 0) -> Optional[List[TorrentInfo]]:
"""
获取站点最新一页的种子,多个站点需要多线程处理
:param site: 站点
+1 -1
View File
@@ -47,7 +47,7 @@ class SiteParserBase(metaclass=ABCMeta):
apikey: str,
token: str,
session: Session = None,
ua: str = None,
ua: Optional[str] = None,
emulate: bool = False,
proxy: bool = None):
super().__init__()
+1 -1
View File
@@ -74,7 +74,7 @@ class FileListSiteUserInfo(SiteParserBase):
self.bonus = StringUtils.str_float(bonus_html[0].xpath("string(.)").strip())
pass
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
做种相关信息
:param html_text:
+1 -1
View File
@@ -87,7 +87,7 @@ class GazelleSiteUserInfo(SiteParserBase):
if join_at_text:
self.join_at = StringUtils.unify_datetime_str(join_at_text[0].strip())
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
做种相关信息
:param html_text:
+1 -1
View File
@@ -121,7 +121,7 @@ class HDDolbySiteUserInfo(SiteParserBase):
"""
pass
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
解析用户做种信息
"""
+1 -1
View File
@@ -111,7 +111,7 @@ class MTorrentSiteUserInfo(SiteParserBase):
"""
pass
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
解析用户做种信息
"""
+1 -1
View File
@@ -147,7 +147,7 @@ class NexusPhpSiteUserInfo(SiteParserBase):
return True, gold * 100 * 100 + silver * 100 + copper
return False, 0.0
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
做种相关信息
:param html_text:
+2 -2
View File
@@ -66,7 +66,7 @@ class NexusRabbitSiteUserInfo(SiteParserBase):
torrents = json.loads(html_text).get("data", [])
except Exception as e:
logger.error(f"解析做种信息失败: {str(e)}")
return
return None
seeding_size = 0
seeding_info = []
@@ -89,7 +89,7 @@ class NexusRabbitSiteUserInfo(SiteParserBase):
messages = json.loads(html_text).get("data", [])
except Exception as e:
logger.error(f"解析未读消息失败: {e}")
return
return None
for msg in messages:
msg_id, msg_unread = msg.get("id"), msg.get("unread")
if not (msg_id and msg_unread) or msg_unread == "no":
+1 -1
View File
@@ -55,7 +55,7 @@ class SmallHorseSiteUserInfo(SiteParserBase):
def _parse_user_detail_info(self, html_text: str):
pass
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
做种相关信息
:param html_text:
+1 -1
View File
@@ -59,7 +59,7 @@ class TNodeSiteUserInfo(SiteParserBase):
"unreadSystem", 0)
pass
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
解析用户做种信息
"""
+1 -1
View File
@@ -59,7 +59,7 @@ class TorrentLeechSiteUserInfo(SiteParserBase):
def _parse_user_detail_info(self, html_text: str):
pass
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
做种相关信息
:param html_text:
+1 -1
View File
@@ -56,7 +56,7 @@ class Unit3dSiteUserInfo(SiteParserBase):
self.join_at = StringUtils.unify_datetime_str(
join_at_text[0].replace('注册日期', '').replace('註冊日期', '').replace('Registration date', ''))
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
做种相关信息
:param html_text:
+1 -1
View File
@@ -73,7 +73,7 @@ class TYemaSiteUserInfo(SiteParserBase):
"""
pass
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: bool = False) -> Optional[str]:
def _parse_user_torrent_seeding_info(self, html_text: str, multi_page: Optional[bool] = False) -> Optional[str]:
"""
解析用户做种信息
"""
+2 -2
View File
@@ -1,4 +1,4 @@
from typing import Tuple, List
from typing import Tuple, List, Optional
from app.core.config import settings
from app.db.systemconfig_oper import SystemConfigOper
@@ -73,7 +73,7 @@ class HddolbySpider:
self._searchurl = f"https://api.{self._domain_host}/api/v1/torrent/search"
self._pageurl = f"{self._domain}details.php?id=%s&hit=1"
def search(self, keyword: str, mtype: MediaType = None, page: int = 0) -> Tuple[bool, List[dict]]:
def search(self, keyword: str, mtype: MediaType = None, page: Optional[int] = 0) -> Tuple[bool, List[dict]]:
"""
搜索
"""
+2 -2
View File
@@ -1,7 +1,7 @@
import base64
import json
import re
from typing import Tuple, List
from typing import Tuple, List, Optional
from app.core.config import settings
from app.db.systemconfig_oper import SystemConfigOper
@@ -65,7 +65,7 @@ class MTorrentSpider:
self._token = indexer.get('token')
self._timeout = indexer.get('timeout') or 15
def search(self, keyword: str, mtype: MediaType = None, page: int = 0) -> Tuple[bool, List[dict]]:
def search(self, keyword: str, mtype: MediaType = None, page: Optional[int] = 0) -> Tuple[bool, List[dict]]:
"""
搜索
"""
+2 -2
View File
@@ -1,5 +1,5 @@
import re
from typing import Tuple, List
from typing import Tuple, List, Optional
from app.core.config import settings
from app.log import logger
@@ -49,7 +49,7 @@ class TNodeSpider:
if csrf_token:
self._token = csrf_token.group(1)
def search(self, keyword: str, page: int = 0) -> Tuple[bool, List[dict]]:
def search(self, keyword: str, page: Optional[int] = 0) -> Tuple[bool, List[dict]]:
if not self._token:
logger.warn(f"{self._name} 未获取到token,无法搜索")
return True, []
+2 -2
View File
@@ -1,4 +1,4 @@
from typing import List, Tuple
from typing import List, Tuple, Optional
from urllib.parse import quote
from app.core.config import settings
@@ -23,7 +23,7 @@ class TorrentLeech:
self._proxy = settings.PROXY
self._timeout = indexer.get('timeout') or 15
def search(self, keyword: str, page: int = 0) -> Tuple[bool, List[dict]]:
def search(self, keyword: str, page: Optional[int] = 0) -> Tuple[bool, List[dict]]:
if StringUtils.is_chinese(keyword):
# 不支持中文
+2 -2
View File
@@ -1,4 +1,4 @@
from typing import Tuple, List
from typing import Tuple, List, Optional
from app.core.config import settings
from app.db.systemconfig_oper import SystemConfigOper
@@ -57,7 +57,7 @@ class YemaSpider:
self._ua = indexer.get('ua')
self._timeout = indexer.get('timeout') or 15
def search(self, keyword: str, mtype: MediaType = None, page: int = 0) -> Tuple[bool, List[dict]]:
def search(self, keyword: str, mtype: MediaType = None, page: Optional[int] = 0) -> Tuple[bool, List[dict]]:
"""
搜索
"""