mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-02 22:21:03 +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 typing import Optional, Any, Tuple, List, Set, Union, Dict
|
||||||
|
|
||||||
from qbittorrentapi import TorrentFilesList
|
from qbittorrentapi import TorrentFilesList
|
||||||
from ruamel.yaml import CommentedMap
|
|
||||||
from transmission_rpc import File
|
from transmission_rpc import File
|
||||||
|
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
@@ -308,7 +307,7 @@ class ChainBase(metaclass=ABCMeta):
|
|||||||
"""
|
"""
|
||||||
return self.run_module("search_collections", name=name)
|
return self.run_module("search_collections", name=name)
|
||||||
|
|
||||||
def search_torrents(self, site: CommentedMap,
|
def search_torrents(self, site: dict,
|
||||||
keywords: List[str],
|
keywords: List[str],
|
||||||
mtype: MediaType = None,
|
mtype: MediaType = None,
|
||||||
page: int = 0) -> List[TorrentInfo]:
|
page: int = 0) -> List[TorrentInfo]:
|
||||||
@@ -323,7 +322,7 @@ class ChainBase(metaclass=ABCMeta):
|
|||||||
return self.run_module("search_torrents", site=site, keywords=keywords,
|
return self.run_module("search_torrents", site=site, keywords=keywords,
|
||||||
mtype=mtype, page=page)
|
mtype=mtype, page=page)
|
||||||
|
|
||||||
def refresh_torrents(self, site: CommentedMap) -> List[TorrentInfo]:
|
def refresh_torrents(self, site: dict) -> List[TorrentInfo]:
|
||||||
"""
|
"""
|
||||||
获取站点最新一页的种子,多个站点需要多线程处理
|
获取站点最新一页的种子,多个站点需要多线程处理
|
||||||
:param site: 站点
|
:param site: 站点
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from typing import Optional, Tuple, Union, Dict
|
|||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
from ruamel.yaml import CommentedMap
|
|
||||||
|
|
||||||
from app.chain import ChainBase
|
from app.chain import ChainBase
|
||||||
from app.core.config import global_vars, settings
|
from app.core.config import global_vars, settings
|
||||||
@@ -55,7 +54,7 @@ class SiteChain(ChainBase):
|
|||||||
"yemapt.org": self.__yema_test,
|
"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: 站点
|
:param site: 站点
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List, Optional, Tuple, Union
|
from typing import List, Optional, Tuple, Union
|
||||||
|
|
||||||
from ruamel.yaml import CommentedMap
|
|
||||||
|
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.core.context import TorrentInfo
|
from app.core.context import TorrentInfo
|
||||||
from app.db.site_oper import SiteOper
|
from app.db.site_oper import SiteOper
|
||||||
@@ -75,7 +73,7 @@ class IndexerModule(_ModuleBase):
|
|||||||
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
def init_setting(self) -> Tuple[str, Union[str, bool]]:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def search_torrents(self, site: CommentedMap,
|
def search_torrents(self, site: dict,
|
||||||
keywords: List[str] = None,
|
keywords: List[str] = None,
|
||||||
mtype: MediaType = None,
|
mtype: MediaType = None,
|
||||||
page: int = 0) -> List[TorrentInfo]:
|
page: int = 0) -> List[TorrentInfo]:
|
||||||
@@ -203,7 +201,7 @@ class IndexerModule(_ModuleBase):
|
|||||||
return __remove_duplicate(torrents)
|
return __remove_duplicate(torrents)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __spider_search(indexer: CommentedMap,
|
def __spider_search(indexer: dict,
|
||||||
search_word: str = None,
|
search_word: str = None,
|
||||||
mtype: MediaType = None,
|
mtype: MediaType = None,
|
||||||
page: int = 0) -> Tuple[bool, List[dict]]:
|
page: int = 0) -> Tuple[bool, List[dict]]:
|
||||||
@@ -216,14 +214,14 @@ class IndexerModule(_ModuleBase):
|
|||||||
:param: timeout: 超时时间
|
:param: timeout: 超时时间
|
||||||
:return: 是否发生错误, 种子列表
|
:return: 是否发生错误, 种子列表
|
||||||
"""
|
"""
|
||||||
_spider = SiteSpider(indexer={k:v for k,v in indexer.items()}, # noqa
|
_spider = SiteSpider(indexer=indexer,
|
||||||
mtype=mtype,
|
mtype=mtype,
|
||||||
keyword=search_word,
|
keyword=search_word,
|
||||||
page=page)
|
page=page)
|
||||||
|
|
||||||
return _spider.is_error, _spider.get_torrents()
|
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: 站点
|
:param site: 站点
|
||||||
@@ -231,7 +229,7 @@ class IndexerModule(_ModuleBase):
|
|||||||
"""
|
"""
|
||||||
return self.search_torrents(site=site)
|
return self.search_torrents(site=site)
|
||||||
|
|
||||||
def refresh_userdata(self, site: CommentedMap) -> Optional[SiteUserData]:
|
def refresh_userdata(self, site: dict) -> Optional[SiteUserData]:
|
||||||
"""
|
"""
|
||||||
刷新站点的用户数据
|
刷新站点的用户数据
|
||||||
:param site: 站点
|
:param site: 站点
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import urllib.parse
|
import urllib.parse
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List
|
||||||
|
|
||||||
from ruamel.yaml import CommentedMap
|
|
||||||
|
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.db.systemconfig_oper import SystemConfigOper
|
from app.db.systemconfig_oper import SystemConfigOper
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
@@ -51,7 +49,7 @@ class HaiDanSpider:
|
|||||||
"7": 1
|
"7": 1
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, indexer: CommentedMap):
|
def __init__(self, indexer: dict):
|
||||||
self.systemconfig = SystemConfigOper()
|
self.systemconfig = SystemConfigOper()
|
||||||
if indexer:
|
if indexer:
|
||||||
self._indexerid = indexer.get('id')
|
self._indexerid = indexer.get('id')
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ import json
|
|||||||
import re
|
import re
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List
|
||||||
|
|
||||||
from ruamel.yaml import CommentedMap
|
|
||||||
|
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.db.systemconfig_oper import SystemConfigOper
|
from app.db.systemconfig_oper import SystemConfigOper
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
@@ -51,7 +49,7 @@ class MTorrentSpider:
|
|||||||
"7": "DIY 国配 中字"
|
"7": "DIY 国配 中字"
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, indexer: CommentedMap):
|
def __init__(self, indexer: dict):
|
||||||
self.systemconfig = SystemConfigOper()
|
self.systemconfig = SystemConfigOper()
|
||||||
if indexer:
|
if indexer:
|
||||||
self._indexerid = indexer.get('id')
|
self._indexerid = indexer.get('id')
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List
|
||||||
|
|
||||||
from ruamel.yaml import CommentedMap
|
|
||||||
|
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
@@ -23,7 +21,7 @@ class TNodeSpider:
|
|||||||
_downloadurl = "%sapi/torrent/download/%s"
|
_downloadurl = "%sapi/torrent/download/%s"
|
||||||
_pageurl = "%storrent/info/%s"
|
_pageurl = "%storrent/info/%s"
|
||||||
|
|
||||||
def __init__(self, indexer: CommentedMap):
|
def __init__(self, indexer: dict):
|
||||||
if indexer:
|
if indexer:
|
||||||
self._indexerid = indexer.get('id')
|
self._indexerid = indexer.get('id')
|
||||||
self._domain = indexer.get('domain')
|
self._domain = indexer.get('domain')
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
from ruamel.yaml import CommentedMap
|
|
||||||
|
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.http import RequestUtils
|
from app.utils.http import RequestUtils
|
||||||
@@ -19,7 +17,7 @@ class TorrentLeech:
|
|||||||
_pageurl = "%storrent/%s"
|
_pageurl = "%storrent/%s"
|
||||||
_timeout = 15
|
_timeout = 15
|
||||||
|
|
||||||
def __init__(self, indexer: CommentedMap):
|
def __init__(self, indexer: dict):
|
||||||
self._indexer = indexer
|
self._indexer = indexer
|
||||||
if indexer.get('proxy'):
|
if indexer.get('proxy'):
|
||||||
self._proxy = settings.PROXY
|
self._proxy = settings.PROXY
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
from typing import Tuple, List
|
from typing import Tuple, List
|
||||||
|
|
||||||
from ruamel.yaml import CommentedMap
|
|
||||||
|
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.db.systemconfig_oper import SystemConfigOper
|
from app.db.systemconfig_oper import SystemConfigOper
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
@@ -46,7 +44,7 @@ class YemaSpider:
|
|||||||
"12": "完结",
|
"12": "完结",
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, indexer: CommentedMap):
|
def __init__(self, indexer: dict):
|
||||||
self.systemconfig = SystemConfigOper()
|
self.systemconfig = SystemConfigOper()
|
||||||
if indexer:
|
if indexer:
|
||||||
self._indexerid = indexer.get('id')
|
self._indexerid = indexer.get('id')
|
||||||
|
|||||||
Reference in New Issue
Block a user