add SEARCH_MULTIPLE_NAME

This commit is contained in:
jxxghp
2024-03-24 08:26:59 +08:00
parent e4bb182668
commit 72b6556c62
5 changed files with 22 additions and 2 deletions

View File

@ -49,6 +49,12 @@ class SiteChain(ChainBase):
"m-team.cc": self.__mteam_test,
}
def is_special_site(self, domain: str) -> bool:
"""
判断是否特殊站点
"""
return domain in self.special_site_test
@staticmethod
def __zhuque_test(site: Site) -> Tuple[bool, str]:
"""

View File

@ -236,6 +236,8 @@ class Settings(BaseSettings):
META_CACHE_EXPIRE: int = 0
# 是否启用DOH解析域名
DOH_ENABLE: bool = True
# 搜索多个名称
SEARCH_MULTIPLE_NAME: bool = True
@validator("SUBSCRIBE_RSS_INTERVAL",
"COOKIECLOUD_INTERVAL",

View File

@ -3,6 +3,7 @@ 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.helper.sites import SitesHelper
from app.log import logger
@ -57,6 +58,8 @@ class IndexerModule(_ModuleBase):
:param _torrents: 种子列表
:return: 去重后的种子列表
"""
if not settings.SEARCH_MULTIPLE_NAME:
return _torrents
# 通过encosure去重
return list({t.enclosure: t for t in _torrents}.values())
@ -109,9 +112,14 @@ class IndexerModule(_ModuleBase):
page=page
)
if not result:
continue
if settings.SEARCH_MULTIPLE_NAME:
# 合并多个结果
result_array.extend(result)
else:
# 有结果就停止
result_array = result
break
# 合并结果
result_array.extend(result)
except Exception as err:
logger.error(f"{site.get('name')} 搜索出错:{str(err)}")