fix M-team 数据统计

This commit is contained in:
jxxghp
2024-04-30 08:25:29 +08:00
parent bc208d36ca
commit cc2926314b
4 changed files with 20 additions and 5 deletions

View File

@@ -27,11 +27,12 @@
"name": "站点数据统计",
"description": "自动统计和展示站点数据。",
"labels": "站点",
"version": "2.9",
"version": "3.0",
"icon": "statistic.png",
"author": "lightolly",
"level": 2,
"history": {
"v3.0": "适配馒头数据统计需要升级至v1.8.5+版本且在站点信息中维护好API Key",
"v2.9": "增强API安全性",
"v2.8": "修复馒头未读消息统计",
"v2.7": "修复憨憨种子信息只统计第一页的问题,增加移除失效统计选项",

View File

@@ -43,7 +43,7 @@ class SiteStatistic(_PluginBase):
# 插件图标
plugin_icon = "statistic.png"
# 插件版本
plugin_version = "2.9"
plugin_version = "3.0"
# 插件作者
plugin_author = "lightolly"
# 作者主页
@@ -1041,6 +1041,8 @@ class SiteStatistic(_PluginBase):
if not site_cookie:
return None
site_name = site_info.get("name")
apikey = site_info.get("apikey")
token = site_info.get("token")
url = site_info.get("url")
proxy = site_info.get("proxy")
ua = site_info.get("ua")
@@ -1124,7 +1126,16 @@ class SiteStatistic(_PluginBase):
if not site_schema:
logger.error("站点 %s 无法识别站点类型" % site_name)
return None
return site_schema(site_name, url, site_cookie, html_text, session=session, ua=ua, proxy=proxy)
return site_schema(
site_name=site_name,
url=url,
site_cookie=site_cookie,
apikey=apikey,
token=token,
index_html=html_text,
session=session,
ua=ua,
proxy=proxy)
return None
def refresh_by_domain(self, domain: str, apikey: str) -> schemas.Response:

View File

@@ -45,6 +45,8 @@ class ISiteUserInfo(metaclass=ABCMeta):
def __init__(self, site_name: str,
url: str,
site_cookie: str,
apikey: str,
token: str,
index_html: str,
session: Session = None,
ua: str = None,
@@ -54,6 +56,8 @@ class ISiteUserInfo(metaclass=ABCMeta):
# 站点信息
self.site_name = None
self.site_url = None
self.apikey = apikey
self.token = token
# 用户信息
self.username = None
self.userid = None

View File

@@ -65,13 +65,12 @@ class MTorrentSiteUserInfo(ISiteUserInfo):
"pageSize": 100
}
self._torrent_seeding_page = "api/member/getUserTorrentList"
domain = StringUtils.get_url_host(self.site_url)
self._torrent_seeding_headers = {
"Content-Type": "application/json",
"Accept": "application/json, text/plain, */*"
}
self._addition_headers = {
"x-api-key": SystemConfigOper().get(f"site.{domain}.apikey"),
"x-api-key": self.apikey,
}
def _parse_logged_in(self, html_text):