mirror of
https://github.com/d0zingcat/MoviePilot-Plugins.git
synced 2026-05-13 15:09:12 +00:00
适配m-team新鉴权机制,需要主程序同步升级
This commit is contained in:
@@ -3,11 +3,12 @@
|
||||
"name": "站点自动签到",
|
||||
"description": "自动模拟登录、签到站点。",
|
||||
"labels": "站点",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"icon": "signin.png",
|
||||
"author": "thsrite",
|
||||
"level": 2,
|
||||
"history": {
|
||||
"v2.2": "适配馒头最新变化,需要升级至v1.8.5+版本且维护好Authorization",
|
||||
"v2.1": "增强API安全性",
|
||||
"v2.0": "站点签到时更新站点使用统计信息,需要主程序升级至v1.8.3+版本",
|
||||
"v1.9": "支持馒头新架构自动签到"
|
||||
@@ -229,11 +230,12 @@
|
||||
"name": "IYUU自动辅种",
|
||||
"description": "基于IYUU官方Api实现自动辅种。",
|
||||
"labels": "做种,IYUU",
|
||||
"version": "1.5",
|
||||
"version": "1.6",
|
||||
"icon": "IYUU.png",
|
||||
"author": "jxxghp",
|
||||
"level": 2,
|
||||
"history": {
|
||||
"v1.6": "适配馒头最新变化,需要升级至v1.8.5+版本且维护好Authorization",
|
||||
"v1.5": "支持馒头新架构辅种"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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.5"
|
||||
plugin_version = "1.6"
|
||||
# 插件作者
|
||||
plugin_author = "jxxghp"
|
||||
# 作者主页
|
||||
@@ -898,12 +898,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(
|
||||
@@ -911,7 +910,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
|
||||
@@ -941,7 +940,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