fix sites
This commit is contained in:
@ -37,6 +37,13 @@ class SearchChain(_ChainBase):
|
|||||||
if not torrents:
|
if not torrents:
|
||||||
logger.warn(f'{keyword or mediainfo.title} 未搜索到资源')
|
logger.warn(f'{keyword or mediainfo.title} 未搜索到资源')
|
||||||
return []
|
return []
|
||||||
|
# 过滤种子
|
||||||
|
result: List[TorrentInfo] = self.run_module("filter_torrents", torrent_list=torrents)
|
||||||
|
if result is not None:
|
||||||
|
torrents = result
|
||||||
|
if not torrents:
|
||||||
|
logger.warn(f'{keyword or mediainfo.title} 没有符合过滤条件的资源')
|
||||||
|
return []
|
||||||
# 过滤不匹配的资源
|
# 过滤不匹配的资源
|
||||||
_match_torrents = []
|
_match_torrents = []
|
||||||
if mediainfo:
|
if mediainfo:
|
||||||
@ -61,13 +68,6 @@ class SearchChain(_ChainBase):
|
|||||||
_match_torrents.append(torrent)
|
_match_torrents.append(torrent)
|
||||||
else:
|
else:
|
||||||
_match_torrents = torrents
|
_match_torrents = torrents
|
||||||
# 过滤种子
|
|
||||||
result: List[TorrentInfo] = self.run_module("filter_torrents", torrent_list=_match_torrents)
|
|
||||||
if result is not None:
|
|
||||||
_match_torrents = result
|
|
||||||
if not _match_torrents:
|
|
||||||
logger.warn(f'{keyword or mediainfo.title} 没有符合过滤条件的资源')
|
|
||||||
return []
|
|
||||||
# 组装上下文返回
|
# 组装上下文返回
|
||||||
return [Context(meta=MetaInfo(torrent.title),
|
return [Context(meta=MetaInfo(torrent.title),
|
||||||
mediainfo=mediainfo,
|
mediainfo=mediainfo,
|
||||||
|
@ -11,6 +11,7 @@ from app.modules import _ModuleBase
|
|||||||
from app.modules.indexer.spider import TorrentSpider
|
from app.modules.indexer.spider import TorrentSpider
|
||||||
from app.modules.indexer.tnode import TNodeSpider
|
from app.modules.indexer.tnode import TNodeSpider
|
||||||
from app.modules.indexer.torrentleech import TorrentLeech
|
from app.modules.indexer.torrentleech import TorrentLeech
|
||||||
|
from app.utils.string import StringUtils
|
||||||
from app.utils.types import MediaType
|
from app.utils.types import MediaType
|
||||||
|
|
||||||
|
|
||||||
@ -72,6 +73,13 @@ class IndexerModule(_ModuleBase):
|
|||||||
search_word = mediainfo.title
|
search_word = mediainfo.title
|
||||||
else:
|
else:
|
||||||
search_word = None
|
search_word = None
|
||||||
|
|
||||||
|
if search_word \
|
||||||
|
and site.get('language') == "en" \
|
||||||
|
and StringUtils.is_chinese(search_word):
|
||||||
|
# 不支持中文
|
||||||
|
return []
|
||||||
|
|
||||||
# 开始索引
|
# 开始索引
|
||||||
result_array = []
|
result_array = []
|
||||||
# 开始计时
|
# 开始计时
|
||||||
|
@ -24,6 +24,11 @@ class TorrentLeech:
|
|||||||
self._proxy = settings.PROXY
|
self._proxy = settings.PROXY
|
||||||
|
|
||||||
def search(self, keyword: str, page: int = 0) -> Tuple[bool, List[dict]]:
|
def search(self, keyword: str, page: int = 0) -> Tuple[bool, List[dict]]:
|
||||||
|
|
||||||
|
if StringUtils.is_chinese(keyword):
|
||||||
|
# 不支持中文
|
||||||
|
return True, []
|
||||||
|
|
||||||
if keyword:
|
if keyword:
|
||||||
url = self._searchurl % (self._indexer.get('domain'), quote(keyword))
|
url = self._searchurl % (self._indexer.get('domain'), quote(keyword))
|
||||||
else:
|
else:
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user