fix 站点未读消息同步主仓库

This commit is contained in:
thsrite
2024-05-04 18:02:18 +08:00
parent 75288aac46
commit d714a0e283
3 changed files with 22 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ MoviePilot三方插件市场https://github.com/thsrite/MoviePilot-Plugins/
### 插件新增
- 站点数据统计 1.4 (无未读消息版本)(废弃)
- 站点未读消息 1.8 (依赖于[站点数据统计]插件)
- 站点未读消息 1.9 (依赖于[站点数据统计]插件)
- [云盘Strm生成 3.7](docs%2FCloudStrm.md)
- [Strm文件模式转换 1.0](docs%2FStrmConvert.md)
- 清理订阅缓存 1.0

View File

@@ -31,11 +31,12 @@
"name": "站点未读消息",
"description": "发送站点未读消息。",
"labels": "站点",
"version": "1.8",
"version": "1.9",
"icon": "Synomail_A.png",
"author": "thsrite",
"level": 2,
"history": {
"v1.9": "同步主仓库",
"v1.8": "自定义保留消息天数",
"v1.7": "删除重复代码、依赖于[站点数据统计]插件",
"v1.6": "增加解析失败日志",

View File

@@ -37,7 +37,7 @@ class SiteUnreadMsg(_PluginBase):
# 插件图标
plugin_icon = "Synomail_A.png"
# 插件版本
plugin_version = "1.8"
plugin_version = "1.9"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -470,6 +470,8 @@ class SiteUnreadMsg(_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")
@@ -522,9 +524,12 @@ class SiteUnreadMsg(_PluginBase):
html_text = res.text
if not html_text:
return None
else:
logger.error("站点 %s 被反爬限制:%s, 状态码:%s" % (site_name, url, res.status_code))
return None
elif res is not None:
logger.error("站点 %s 被反爬限制:%s, 状态码:%s" % (site_name, url, res.status_code))
return None
else:
logger.error("站点 %s 无法访问:%s" % (site_name, url))
return None
# 兼容假首页情况,假首页通常没有 <link rel="search" 属性
if '"search"' not in html_text and '"csrf-token"' not in html_text:
@@ -553,7 +558,16 @@ class SiteUnreadMsg(_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_site_data(self, site_info: CommentedMap):