fix bug
This commit is contained in:
@ -3,6 +3,8 @@ from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from datetime import datetime
|
||||
from typing import List, Optional, Tuple, Union
|
||||
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core import MediaInfo, TorrentInfo
|
||||
from app.log import logger
|
||||
from app.modules import _ModuleBase
|
||||
@ -23,7 +25,7 @@ class IndexerModule(_ModuleBase):
|
||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||
return "INDEXER", "builtin"
|
||||
|
||||
def search_torrents(self, mediainfo: Optional[MediaInfo], sites: List[dict],
|
||||
def search_torrents(self, mediainfo: Optional[MediaInfo], sites: List[CommentedMap],
|
||||
keyword: str = None) -> Optional[List[TorrentInfo]]:
|
||||
"""
|
||||
搜索站点,多个站点需要多线程处理
|
||||
@ -54,7 +56,7 @@ class IndexerModule(_ModuleBase):
|
||||
# 返回
|
||||
return results
|
||||
|
||||
def __search(self, mediainfo: MediaInfo, site: dict,
|
||||
def __search(self, mediainfo: MediaInfo, site: CommentedMap,
|
||||
keyword: str = None) -> Optional[List[TorrentInfo]]:
|
||||
"""
|
||||
搜索一个站点
|
||||
@ -111,7 +113,7 @@ class IndexerModule(_ModuleBase):
|
||||
**result) for result in result_array]
|
||||
|
||||
@staticmethod
|
||||
def __spider_search(indexer: dict,
|
||||
def __spider_search(indexer: CommentedMap,
|
||||
keyword: str = None,
|
||||
mtype: MediaType = None,
|
||||
page: int = None, timeout: int = 30) -> (bool, List[dict]):
|
||||
@ -145,7 +147,7 @@ class IndexerModule(_ModuleBase):
|
||||
_spider.torrents_info_array.clear()
|
||||
return result_flag, result_array
|
||||
|
||||
def refresh_torrents(self, sites: List[dict]) -> Optional[List[TorrentInfo]]:
|
||||
def refresh_torrents(self, sites: List[CommentedMap]) -> Optional[List[TorrentInfo]]:
|
||||
"""
|
||||
获取站点最新一页的种子,多个站点需要多线程处理
|
||||
:param sites: 站点列表
|
||||
|
@ -7,6 +7,7 @@ import feapder
|
||||
from feapder.utils.tools import urlencode
|
||||
from jinja2 import Template
|
||||
from pyquery import PyQuery
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core import settings
|
||||
from app.log import logger
|
||||
@ -81,7 +82,7 @@ class TorrentSpider(feapder.AirSpider):
|
||||
# 种子列表
|
||||
torrents_info_array: list = []
|
||||
|
||||
def setparam(self, indexer,
|
||||
def setparam(self, indexer: CommentedMap,
|
||||
keyword: [str, list] = None,
|
||||
page=None,
|
||||
referer=None,
|
||||
|
@ -1,6 +1,8 @@
|
||||
import re
|
||||
from typing import Tuple, List
|
||||
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core import settings
|
||||
from app.log import logger
|
||||
from app.utils.http import RequestUtils
|
||||
@ -20,7 +22,7 @@ class TNodeSpider:
|
||||
_downloadurl = "%sapi/torrent/download/%s"
|
||||
_pageurl = "%storrent/info/%s"
|
||||
|
||||
def __init__(self, indexer: dict):
|
||||
def __init__(self, indexer: CommentedMap):
|
||||
if indexer:
|
||||
self._indexerid = indexer.get('id')
|
||||
self._domain = indexer.get('domain')
|
||||
|
@ -1,6 +1,8 @@
|
||||
from typing import List, Tuple
|
||||
from urllib.parse import quote
|
||||
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core import settings
|
||||
from app.log import logger
|
||||
from app.utils.http import RequestUtils
|
||||
@ -16,7 +18,7 @@ class TorrentLeech:
|
||||
_downloadurl = "%sdownload/%s/%s"
|
||||
_pageurl = "%storrent/%s"
|
||||
|
||||
def __init__(self, indexer: dict):
|
||||
def __init__(self, indexer: CommentedMap):
|
||||
self._indexer = indexer
|
||||
if indexer.get('proxy'):
|
||||
self._proxy = settings.PROXY
|
||||
|
Reference in New Issue
Block a user