mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-02-12 15:06:35 +08:00
fix sites
This commit is contained in:
@@ -7,7 +7,6 @@ from pathlib import Path
|
||||
from typing import Optional, Any, Tuple, List, Set, Union, Dict
|
||||
|
||||
from qbittorrentapi import TorrentFilesList
|
||||
from ruamel.yaml import CommentedMap
|
||||
from transmission_rpc import File
|
||||
|
||||
from app.core.config import settings
|
||||
@@ -308,7 +307,7 @@ class ChainBase(metaclass=ABCMeta):
|
||||
"""
|
||||
return self.run_module("search_collections", name=name)
|
||||
|
||||
def search_torrents(self, site: CommentedMap,
|
||||
def search_torrents(self, site: dict,
|
||||
keywords: List[str],
|
||||
mtype: MediaType = None,
|
||||
page: int = 0) -> List[TorrentInfo]:
|
||||
@@ -323,7 +322,7 @@ class ChainBase(metaclass=ABCMeta):
|
||||
return self.run_module("search_torrents", site=site, keywords=keywords,
|
||||
mtype=mtype, page=page)
|
||||
|
||||
def refresh_torrents(self, site: CommentedMap) -> List[TorrentInfo]:
|
||||
def refresh_torrents(self, site: dict) -> List[TorrentInfo]:
|
||||
"""
|
||||
获取站点最新一页的种子,多个站点需要多线程处理
|
||||
:param site: 站点
|
||||
|
||||
@@ -6,7 +6,6 @@ from typing import Optional, Tuple, Union, Dict
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from lxml import etree
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.chain import ChainBase
|
||||
from app.core.config import global_vars, settings
|
||||
@@ -55,7 +54,7 @@ class SiteChain(ChainBase):
|
||||
"yemapt.org": self.__yema_test,
|
||||
}
|
||||
|
||||
def refresh_userdata(self, site: CommentedMap = None) -> Optional[SiteUserData]:
|
||||
def refresh_userdata(self, site: dict = None) -> Optional[SiteUserData]:
|
||||
"""
|
||||
刷新站点的用户数据
|
||||
:param site: 站点
|
||||
|
||||
@@ -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: 站点
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import urllib.parse
|
||||
from typing import Tuple, List
|
||||
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core.config import settings
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.log import logger
|
||||
@@ -51,7 +49,7 @@ class HaiDanSpider:
|
||||
"7": 1
|
||||
}
|
||||
|
||||
def __init__(self, indexer: CommentedMap):
|
||||
def __init__(self, indexer: dict):
|
||||
self.systemconfig = SystemConfigOper()
|
||||
if indexer:
|
||||
self._indexerid = indexer.get('id')
|
||||
|
||||
@@ -3,8 +3,6 @@ import json
|
||||
import re
|
||||
from typing import Tuple, List
|
||||
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core.config import settings
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.log import logger
|
||||
@@ -51,7 +49,7 @@ class MTorrentSpider:
|
||||
"7": "DIY 国配 中字"
|
||||
}
|
||||
|
||||
def __init__(self, indexer: CommentedMap):
|
||||
def __init__(self, indexer: dict):
|
||||
self.systemconfig = SystemConfigOper()
|
||||
if indexer:
|
||||
self._indexerid = indexer.get('id')
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import re
|
||||
from typing import Tuple, List
|
||||
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core.config import settings
|
||||
from app.log import logger
|
||||
from app.utils.http import RequestUtils
|
||||
@@ -23,7 +21,7 @@ class TNodeSpider:
|
||||
_downloadurl = "%sapi/torrent/download/%s"
|
||||
_pageurl = "%storrent/info/%s"
|
||||
|
||||
def __init__(self, indexer: CommentedMap):
|
||||
def __init__(self, indexer: dict):
|
||||
if indexer:
|
||||
self._indexerid = indexer.get('id')
|
||||
self._domain = indexer.get('domain')
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
from typing import List, Tuple
|
||||
from urllib.parse import quote
|
||||
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core.config import settings
|
||||
from app.log import logger
|
||||
from app.utils.http import RequestUtils
|
||||
@@ -19,7 +17,7 @@ class TorrentLeech:
|
||||
_pageurl = "%storrent/%s"
|
||||
_timeout = 15
|
||||
|
||||
def __init__(self, indexer: CommentedMap):
|
||||
def __init__(self, indexer: dict):
|
||||
self._indexer = indexer
|
||||
if indexer.get('proxy'):
|
||||
self._proxy = settings.PROXY
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
from typing import Tuple, List
|
||||
|
||||
from ruamel.yaml import CommentedMap
|
||||
|
||||
from app.core.config import settings
|
||||
from app.db.systemconfig_oper import SystemConfigOper
|
||||
from app.log import logger
|
||||
@@ -46,7 +44,7 @@ class YemaSpider:
|
||||
"12": "完结",
|
||||
}
|
||||
|
||||
def __init__(self, indexer: CommentedMap):
|
||||
def __init__(self, indexer: dict):
|
||||
self.systemconfig = SystemConfigOper()
|
||||
if indexer:
|
||||
self._indexerid = indexer.get('id')
|
||||
|
||||
Reference in New Issue
Block a user