fix sites

This commit is contained in:
jxxghp
2025-02-14 13:44:18 +08:00
parent 4c9afcc1a8
commit 30eb4385d4
8 changed files with 13 additions and 27 deletions

View File

@@ -1,8 +1,6 @@
from datetime import datetime
from typing import List, Optional, Tuple, Union
from ruamel.yaml import CommentedMap
from app.core.config import settings
from app.core.context import TorrentInfo
from app.db.site_oper import SiteOper
@@ -75,7 +73,7 @@ class IndexerModule(_ModuleBase):
def init_setting(self) -> Tuple[str, Union[str, bool]]:
pass
def search_torrents(self, site: CommentedMap,
def search_torrents(self, site: dict,
keywords: List[str] = None,
mtype: MediaType = None,
page: int = 0) -> List[TorrentInfo]:
@@ -203,7 +201,7 @@ class IndexerModule(_ModuleBase):
return __remove_duplicate(torrents)
@staticmethod
def __spider_search(indexer: CommentedMap,
def __spider_search(indexer: dict,
search_word: str = None,
mtype: MediaType = None,
page: int = 0) -> Tuple[bool, List[dict]]:
@@ -216,14 +214,14 @@ class IndexerModule(_ModuleBase):
:param: timeout: 超时时间
:return: 是否发生错误, 种子列表
"""
_spider = SiteSpider(indexer={k:v for k,v in indexer.items()}, # noqa
_spider = SiteSpider(indexer=indexer,
mtype=mtype,
keyword=search_word,
page=page)
return _spider.is_error, _spider.get_torrents()
def refresh_torrents(self, site: CommentedMap) -> Optional[List[TorrentInfo]]:
def refresh_torrents(self, site: dict) -> Optional[List[TorrentInfo]]:
"""
获取站点最新一页的种子,多个站点需要多线程处理
:param site: 站点
@@ -231,7 +229,7 @@ class IndexerModule(_ModuleBase):
"""
return self.search_torrents(site=site)
def refresh_userdata(self, site: CommentedMap) -> Optional[SiteUserData]:
def refresh_userdata(self, site: dict) -> Optional[SiteUserData]:
"""
刷新站点的用户数据
:param site: 站点