From 59d2d936a0d343db80df6dfbdf3a50ea14722a52 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 26 Apr 2024 11:30:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=A6=92=E5=A4=B4=E6=96=B0?= =?UTF-8?q?=E6=9E=B6=E6=9E=84=E8=BE=85=E7=A7=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 7 ++++-- plugins/iyuuautoseed/__init__.py | 37 +++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5d14ef7..d3ecb75 100644 --- a/package.json +++ b/package.json @@ -208,10 +208,13 @@ "IYUUAutoSeed": { "name": "IYUU自动辅种", "description": "基于IYUU官方Api实现自动辅种。", - "version": "1.3", + "version": "1.4", "icon": "IYUU.png", "author": "jxxghp", - "level": 2 + "level": 2, + "history": { + "v1.4": "支持馒头新架构辅种" + } }, "CrossSeed": { "name": "青蛙辅种助手", diff --git a/plugins/iyuuautoseed/__init__.py b/plugins/iyuuautoseed/__init__.py index 7ce742b..1e3ba3d 100644 --- a/plugins/iyuuautoseed/__init__.py +++ b/plugins/iyuuautoseed/__init__.py @@ -34,7 +34,7 @@ class IYUUAutoSeed(_PluginBase): # 插件图标 plugin_icon = "IYUU.png" # 插件版本 - plugin_version = "1.3" + plugin_version = "1.4" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -892,7 +892,35 @@ class IYUUAutoSeed(_PluginBase): 拼装种子下载链接 """ - def __is_special_site(url): + def __is_mteam(url: str): + """ + 判断是否为mteam站点 + """ + return True if "m-team." in url else False + + def __get_mteam_enclosure(tid: str): + """ + 获取mteam种子下载链接 + """ + _apikey = self.systemconfig.get(f"site.m-team.apikey") + if not _apikey: + logger.error("m-team站点的apikey未配置") + return None + with RequestUtils( + headers={ + 'Content-Type': 'application/json', + 'User-Agent': f'{site.get("ua")}', + 'Accept': 'application/json, text/plain, */*', + 'x-api-key': _apikey + } + ).post_res(f"{site.get('url')}api/torrent/genDlToken", params={ + 'id': tid + }) as res: + if not res: + logger.warn(f"m-team 获取种子下载链接失败:{tid}") + return None + + def __is_special_site(url: str): """ 判断是否为特殊站点 """ @@ -910,7 +938,10 @@ class IYUUAutoSeed(_PluginBase): return False try: - if __is_special_site(site.get('url')): + if __is_mteam(site.get('url')): + # 调用mteam接口获取下载链接 + return __get_mteam_enclosure(seed.get("torrent_id")) + elif __is_special_site(site.get('url')): # 从详情页面获取下载链接 return self.__get_torrent_url_from_page(seed=seed, site=site) else: