mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix: stop torrent search paging after short pages
This commit is contained in:
@@ -22,6 +22,8 @@ class SiteSpider:
|
||||
站点爬虫
|
||||
"""
|
||||
|
||||
_default_result_num = 100
|
||||
|
||||
@property
|
||||
def __class__(self):
|
||||
return object
|
||||
@@ -67,7 +69,7 @@ class SiteSpider:
|
||||
self.list = self.browse.get('list') or self.list
|
||||
self.fields = self.browse.get('fields') or self.fields
|
||||
self.domain = indexer.get('domain')
|
||||
self.result_num = int(indexer.get('result_num') or 100)
|
||||
self.result_num = int(indexer.get('result_num') or self.default_result_num())
|
||||
self._timeout = int(indexer.get('timeout') or 15)
|
||||
self.page = page
|
||||
if self.domain and not str(self.domain).endswith("/"):
|
||||
@@ -82,6 +84,13 @@ class SiteSpider:
|
||||
self.torrents_info = {}
|
||||
self.torrents_info_array = []
|
||||
|
||||
@classmethod
|
||||
def default_result_num(cls) -> int:
|
||||
"""
|
||||
获取普通配置站点的默认单页数量。
|
||||
"""
|
||||
return cls._default_result_num
|
||||
|
||||
def __get_search_url(self):
|
||||
"""
|
||||
获取搜索URL
|
||||
|
||||
@@ -49,6 +49,13 @@ class HaiDanSpider:
|
||||
"7": 1
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_search_page_size(cls, keyword: str = None) -> None:
|
||||
"""
|
||||
海胆搜索入口当前没有接入页码参数,不参与自动翻页。
|
||||
"""
|
||||
return None
|
||||
|
||||
def __init__(self, indexer: dict):
|
||||
self.systemconfig = SystemConfigOper()
|
||||
if indexer:
|
||||
|
||||
@@ -20,7 +20,7 @@ class HddolbySpider:
|
||||
_cookie = None
|
||||
_ua = None
|
||||
_apikey = None
|
||||
_size = 40
|
||||
_size = 100
|
||||
_pageurl = None
|
||||
_timeout = 15
|
||||
_searchurl = None
|
||||
@@ -57,6 +57,13 @@ class HddolbySpider:
|
||||
"hfr": "高帧率",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_search_page_size(cls, keyword: Optional[str] = None) -> Optional[int]:
|
||||
"""
|
||||
获取搜索接口单页容量。
|
||||
"""
|
||||
return cls._size
|
||||
|
||||
def __init__(self, indexer: dict):
|
||||
self.systemconfig = SystemConfigOper()
|
||||
if indexer:
|
||||
@@ -88,7 +95,7 @@ class HddolbySpider:
|
||||
return {
|
||||
"keyword": keyword,
|
||||
"page_number": page,
|
||||
"page_size": 100,
|
||||
"page_size": self._size,
|
||||
"categories": categories,
|
||||
"visible": 1,
|
||||
}
|
||||
|
||||
@@ -53,6 +53,13 @@ class MTorrentSpider:
|
||||
"7": "DIY 国配 中字"
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_search_page_size(cls, keyword: Optional[str] = None) -> Optional[int]:
|
||||
"""
|
||||
获取搜索接口单页容量。
|
||||
"""
|
||||
return cls._size
|
||||
|
||||
def __init__(self, indexer: dict):
|
||||
self.systemconfig = SystemConfigOper()
|
||||
if indexer:
|
||||
|
||||
@@ -39,6 +39,13 @@ class RousiSpider:
|
||||
# API KEY
|
||||
_apikey = None
|
||||
|
||||
@classmethod
|
||||
def get_search_page_size(cls, keyword: Optional[str] = None) -> Optional[int]:
|
||||
"""
|
||||
获取搜索接口单页容量。
|
||||
"""
|
||||
return cls._size
|
||||
|
||||
def __init__(self, indexer: dict):
|
||||
self.systemconfig = SystemConfigOper()
|
||||
if indexer:
|
||||
|
||||
@@ -17,6 +17,13 @@ class TNodeSpider(metaclass=SingletonClass):
|
||||
_downloadurl = "%sapi/torrent/download/%s"
|
||||
_pageurl = "%storrent/info/%s"
|
||||
|
||||
@classmethod
|
||||
def get_search_page_size(cls, keyword: Optional[str] = None) -> Optional[int]:
|
||||
"""
|
||||
获取搜索接口单页容量。
|
||||
"""
|
||||
return cls._size
|
||||
|
||||
def __init__(self, indexer: dict):
|
||||
if indexer:
|
||||
self._indexerid = indexer.get('id')
|
||||
|
||||
@@ -17,6 +17,13 @@ class TorrentLeech:
|
||||
_pageurl = "%storrent/%s"
|
||||
_timeout = 15
|
||||
|
||||
@classmethod
|
||||
def get_search_page_size(cls, keyword: Optional[str] = None) -> Optional[int]:
|
||||
"""
|
||||
获取搜索接口单页容量;关键词搜索 URL 当前没有可靠页码入口。
|
||||
"""
|
||||
return None if keyword else cls._size
|
||||
|
||||
def __init__(self, indexer: dict):
|
||||
self._indexer = indexer
|
||||
if indexer.get('proxy'):
|
||||
|
||||
@@ -44,6 +44,13 @@ class YemaSpider:
|
||||
"12": "完结",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get_search_page_size(cls, keyword: Optional[str] = None) -> Optional[int]:
|
||||
"""
|
||||
获取搜索接口单页容量。
|
||||
"""
|
||||
return cls._size
|
||||
|
||||
def __init__(self, indexer: dict):
|
||||
self.systemconfig = SystemConfigOper()
|
||||
if indexer:
|
||||
|
||||
Reference in New Issue
Block a user