mirror of
https://github.com/d0zingcat/MoviePilot-Plugins.git
synced 2026-05-20 15:09:33 +00:00
Merge branch 'jxxghp_main'
* jxxghp_main: 适配m-team新鉴权机制,需要主程序同步升级 适配m-team新鉴权机制,需要主程序同步升级 # Conflicts: # package.json
This commit is contained in:
@@ -38,7 +38,7 @@ class AutoSignIn(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "signin.png"
|
||||
# 插件版本
|
||||
plugin_version = "2.1"
|
||||
plugin_version = "2.2"
|
||||
# 插件作者
|
||||
plugin_author = "thsrite"
|
||||
# 作者主页
|
||||
@@ -988,9 +988,14 @@ class AutoSignIn(_PluginBase):
|
||||
"""
|
||||
mteam登录
|
||||
"""
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": site.get("ua"),
|
||||
"Accept": "application/json, text/plain, */*",
|
||||
"Authorization": site.get("token")
|
||||
}
|
||||
# 更新最后访问时间
|
||||
res = RequestUtils(cookies=site.get("cookie"),
|
||||
ua=site.get("ua"),
|
||||
res = RequestUtils(headers=headers,
|
||||
timeout=60,
|
||||
proxies=settings.PROXY if site.get("proxy") else None,
|
||||
referer=f"{site.get('url')}index"
|
||||
|
||||
@@ -40,7 +40,7 @@ class _ISiteSigninHandler(metaclass=ABCMeta):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def get_page_source(url: str, cookie: str, ua: str, proxy: bool, render: bool) -> str:
|
||||
def get_page_source(url: str, cookie: str, ua: str, proxy: bool, render: bool, token: str = None) -> str:
|
||||
"""
|
||||
获取页面源码
|
||||
:param url: Url地址
|
||||
@@ -48,6 +48,7 @@ class _ISiteSigninHandler(metaclass=ABCMeta):
|
||||
:param ua: UA
|
||||
:param proxy: 是否使用代理
|
||||
:param render: 是否渲染
|
||||
:param token: JWT Token
|
||||
:return: 页面源码,错误信息
|
||||
"""
|
||||
if render:
|
||||
@@ -56,10 +57,18 @@ class _ISiteSigninHandler(metaclass=ABCMeta):
|
||||
ua=ua,
|
||||
proxies=settings.PROXY_SERVER if proxy else None)
|
||||
else:
|
||||
res = RequestUtils(cookies=cookie,
|
||||
ua=ua,
|
||||
proxies=settings.PROXY if proxy else None
|
||||
).get_res(url=url)
|
||||
if token:
|
||||
headers = {
|
||||
"Authorization": token,
|
||||
"User-Agent": ua
|
||||
}
|
||||
else:
|
||||
headers = {
|
||||
"User-Agent": ua,
|
||||
"Cookie": cookie
|
||||
}
|
||||
res = RequestUtils(headers=headers,
|
||||
proxies=settings.PROXY if proxy else None).get_res(url=url)
|
||||
if res is not None:
|
||||
# 使用chardet检测字符编码
|
||||
raw_data = res.content
|
||||
|
||||
@@ -37,6 +37,7 @@ class MTorrent(_ISiteSigninHandler):
|
||||
proxy = site_info.get("proxy")
|
||||
render = site_info.get("render")
|
||||
url = site_info.get("url")
|
||||
token = site_info.get("token")
|
||||
if render:
|
||||
# 获取页面html
|
||||
html_text = self.get_page_source(url=url,
|
||||
@@ -52,8 +53,13 @@ class MTorrent(_ISiteSigninHandler):
|
||||
return False, '模拟登录失败,Cookie已失效'
|
||||
return True, '模拟登录成功'
|
||||
else:
|
||||
res = RequestUtils(cookies=site_cookie,
|
||||
ua=ua,
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
"User-Agent": ua,
|
||||
"Accept": "application/json, text/plain, */*",
|
||||
"Authorization": token
|
||||
}
|
||||
res = RequestUtils(headers=headers,
|
||||
timeout=60,
|
||||
proxies=settings.PROXY if proxy else None
|
||||
).post_res(url=urljoin(url, "api/member/updateLastBrowse"))
|
||||
|
||||
@@ -34,7 +34,7 @@ class IYUUAutoSeed(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "IYUU.png"
|
||||
# 插件版本
|
||||
plugin_version = "1.6"
|
||||
plugin_version = "1.7"
|
||||
# 插件作者
|
||||
plugin_author = "jxxghp"
|
||||
# 作者主页
|
||||
@@ -936,12 +936,11 @@ class IYUUAutoSeed(_PluginBase):
|
||||
"""
|
||||
return True if "m-team." in url else False
|
||||
|
||||
def __get_mteam_enclosure(tid: str):
|
||||
def __get_mteam_enclosure(tid: str, apikey: str):
|
||||
"""
|
||||
获取mteam种子下载链接
|
||||
"""
|
||||
_apikey = self.systemconfig.get(f"site.m-team.apikey")
|
||||
if not _apikey:
|
||||
if not apikey:
|
||||
logger.error("m-team站点的apikey未配置")
|
||||
return None
|
||||
with RequestUtils(
|
||||
@@ -949,7 +948,7 @@ class IYUUAutoSeed(_PluginBase):
|
||||
'Content-Type': 'application/json',
|
||||
'User-Agent': f'{site.get("ua")}',
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'x-api-key': _apikey
|
||||
'x-api-key': apikey
|
||||
}
|
||||
).post_res(f"{site.get('url')}api/torrent/genDlToken", params={
|
||||
'id': tid
|
||||
@@ -979,7 +978,7 @@ class IYUUAutoSeed(_PluginBase):
|
||||
try:
|
||||
if __is_mteam(site.get('url')):
|
||||
# 调用mteam接口获取下载链接
|
||||
return __get_mteam_enclosure(seed.get("torrent_id"))
|
||||
return __get_mteam_enclosure(tid=seed.get("torrent_id"), apikey=site.get("apikey"))
|
||||
elif __is_special_site(site.get('url')):
|
||||
# 从详情页面获取下载链接
|
||||
return self.__get_torrent_url_from_page(seed=seed, site=site)
|
||||
|
||||
Reference in New Issue
Block a user