@hongmaple0820/dsh-wxmp 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +181 -2
- package/bin/mcp.mjs +9 -0
- package/client.js +6738 -0
- package/cordis.patch.yml +11 -0
- package/icon.svg +1 -0
- package/index.js +2262 -0
- package/lib/auth.js +526 -0
- package/lib/briefing.js +262 -0
- package/lib/discover.js +915 -0
- package/lib/export.js +985 -0
- package/lib/hot.js +447 -0
- package/lib/packs.js +43 -0
- package/lib/poll.js +347 -0
- package/lib/radar.js +232 -0
- package/lib/rss.js +137 -0
- package/lib/store.js +622 -0
- package/lib/trends.js +163 -0
- package/lib/webhook.js +151 -0
- package/lib/wechat.js +996 -0
- package/locale/en.json +12 -0
- package/locale/zh.json +12 -0
- package/package.json +44 -4
package/README.md
CHANGED
|
@@ -1,3 +1,182 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hongmaple0820/dsh-wxmp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **v1.0.0** · 微信公众号订阅、全网热文发现与离线归档工作台(DSH 插件)
|
|
4
|
+
> **WeChat Official Accounts, Cross-Platform Trend Radar & Offline Archive Workbench for DSH**
|
|
5
|
+
|
|
6
|
+
[](#)
|
|
7
|
+
[](#)
|
|
8
|
+
[](#国际化支持--internationalization)
|
|
9
|
+
|
|
10
|
+
[English Overview](#english-overview) · [快速安装](#快速安装) · [核心能力](#核心能力) · [国际化支持](#国际化支持--internationalization) · [界面标签页](#界面标签页) · [AI 工具列表](#ai-工具列表21-个) · [HTTP 接口路由](#http-接口路由) · [配置与存储](#配置与存储) · [测试验证](#测试验证)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 核心能力
|
|
15
|
+
|
|
16
|
+
`@hongmaple0820/dsh-wxmp` 是面向 Digital Shell (DSH) 的零外部运行时依赖(`0` runtime dependencies)微信公众号与热点情报插件,解决微信官方后台 `200013` 频控与扫码过期痛点,完整覆盖**发现 → 订阅 → 阅读 → 分析 → 推送 → 归档**链路:
|
|
17
|
+
|
|
18
|
+
- **免登录 / 零 200013 合集直连通道(Album Direct Sync)**:支持直接订阅微信公开合集页 `mp.weixin.qq.com/mp/appmsgalbum`,无需扫码、永不触发 `ret=200013` 频控;粘贴任意微信文章链接即可自动识别所属公众号 `biz` 与公开合集列表,一键升级或订阅合集源。
|
|
19
|
+
- **全网公开热文实时探测 + 热点风向标**:聚合 11 路公开信息源实时探测科技/AI/商业热文,支持话题簇(Topic Cluster)跨源共振分析、头条位识别、快照趋势对比(新上榜 / 飙升 / 持续霸榜 / 回落)。
|
|
20
|
+
- **追踪词雷达(Watch Keyword Radar)与每日早报**:支持词边界匹配关注词、新命中未读角标与一键标已读;生成结构化每日早报(Daily Briefing)与 AI 摘要,并支持领域订阅包一键导入。
|
|
21
|
+
- **可选微信读书备选通道(WeRead Fallback)**:当普通扫码订阅号撞 `200013` 频控时,若已配置微信读书 Cookie,可自动回退拉取最新文章;无 Cookie 则安全跳过。
|
|
22
|
+
- **多账号凭证池与断点优先调度**:支持多公众号凭证轮换、单号 `200013` 冷却隔离、按历史发文时段排序与断点优先续抓,无需因单号受限而中断整轮同步。
|
|
23
|
+
- **安全防盗链图片代理与正文还原**:内置严格 SSRF 白名单校验的 `/api/plugins/wxmp/image` 代理与正文 HTML→Markdown 解析,稳定渲染微信防盗链图片与嵌套代码块。
|
|
24
|
+
- **7 种格式离线导出与外部集成**:支持 **HTML / Markdown (ZIP) / JSON / DOCX / PDF / XLSX / EPUB** 导出、个人/聚合 RSS 2.0、OPML、CSV 与 Feishu / WeCom / DingTalk / 通用 Webhook 实时推送。
|
|
25
|
+
- **完整中英双语界面(`zh` / `en`)**:内置 DSH 官方 `locale/zh.json` 与 `locale/en.json`、`html[lang]` 自动探测与实时监听,以及顶栏一键 `EN / 中文` 切换与 `localStorage` 持久化。
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 快速安装
|
|
30
|
+
|
|
31
|
+
在 DSH 目录执行(将 `<path-to-repo>` 替换为本地仓库实际路径):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm dsh plugin install <path-to-repo>/packages/dsh-wxmp
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 国际化支持 / Internationalization
|
|
40
|
+
|
|
41
|
+
- **插件元数据与标签页**:提供标准 DSH [locale/zh.json](./locale/zh.json) 与 [locale/en.json](./locale/en.json),完整覆盖 `meta.title`、`meta.description`、`panel.name` 及 5 个主标签页名称。
|
|
42
|
+
- **前端界面自适应与切换**:
|
|
43
|
+
1. 优先读取用户手动切换并持久化在 `localStorage`(键名 `dsh.wxmp.lang`)中的语言偏好(`zh` 或 `en`)。
|
|
44
|
+
2. 若未手动覆盖,自动跟随宿主 `<html lang>` 属性(并挂载 `MutationObserver` 实时响应宿主语言变化)或 `navigator.language`。
|
|
45
|
+
3. 面板顶栏右侧提供 `EN` / `中文` 快捷切换按钮,点击后即时刷新全部按钮、弹窗、时间格式、热点标签、抽屉正文提示与滑块指示条宽度,且不重复触发接口请求。
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 界面标签页
|
|
50
|
+
|
|
51
|
+
| 标签页(中文) | Tab (English) | 说明 |
|
|
52
|
+
| :--- | :--- | :--- |
|
|
53
|
+
| **文章** | **Articles** | 本地已归档/在线文章检索、按公众号/分类/收藏/未读筛选、粘贴链接直接阅读、侧滑阅读抽屉(含自动发现合集升级提示) |
|
|
54
|
+
| **热点** | **Hot** | 11 路全网热文实时探测、站内跨号热点话题簇共振排行、追踪词雷达与每日早报工作台 |
|
|
55
|
+
| **订阅** | **Subscriptions** | 扫码登录与凭证状态总览、公众号搜索订阅、合集直连免登录订阅(Album Direct Sync)、领域订阅包、分类管理、7 格式批量导出与 OPML / CSV / RSS 集成 |
|
|
56
|
+
| **工具** | **Tools** | 单篇链接即时解析、微信验证与频控辅助提示、RSS / JSON Feed 端点与 21 个 AI 工具集成文档 |
|
|
57
|
+
| **系统** | **System** | 运行状态与配额监控、黑名单管理、可选微信读书备选通道配置与多平台 Webhook 推送管理 |
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## AI 工具列表(21 个)
|
|
62
|
+
|
|
63
|
+
| 工具名 | 用途 |
|
|
64
|
+
| :--- | :--- |
|
|
65
|
+
| `wxmp_login_status` | 查询当前公众号后台登录凭证状态与多账号池概要 |
|
|
66
|
+
| `wxmp_search_accounts` | 按关键词检索公众号(返回名称、fakeid、头像与简介) |
|
|
67
|
+
| `wxmp_list_articles` | 在线拉取指定公众号文章列表或正文摘要 |
|
|
68
|
+
| `wxmp_read_article` | 抓取并解析单篇微信文章正文与所属合集元数据 |
|
|
69
|
+
| `wxmp_subscribe` | 添加公众号订阅(支持指定 `category` 分类标签) |
|
|
70
|
+
| `wxmp_unsubscribe` | 取消指定公众号订阅 |
|
|
71
|
+
| `wxmp_list_subscriptions` | 列出当前全部已订阅公众号及合集源 |
|
|
72
|
+
| `wxmp_local_articles` | 检索本地持久化存储中的已归档文章(支持关键词/分类/分页) |
|
|
73
|
+
| `wxmp_sync` | 手动触发多账号/多订阅增量同步并投递 Webhook |
|
|
74
|
+
| `wxmp_poll` | 无参触发一次即时后台轮询(`pollOnce`)抓取全部已订阅更新 |
|
|
75
|
+
| `wxmp_get_rss_url` | 获取指定公众号或聚合 RSS 2.0 订阅链接及轮询状态 |
|
|
76
|
+
| `wxmp_fetch_history` | 探测并查看公众号历史发文批次记录 |
|
|
77
|
+
| `wxmp_hot_articles` | 基于本地已抓取文章计算跨号热点共振排行与话题簇 |
|
|
78
|
+
| `wxmp_discover_hot` | 无需扫码,实时聚合 11 路公开源探测全网当前热文 |
|
|
79
|
+
| `wxmp_watch_radar` | 管理关注追踪词与未读命中告警(增删关键词、标记已读) |
|
|
80
|
+
| `wxmp_daily_briefing` | 生成今日或指定窗口的公众号热点早报与领域总结 |
|
|
81
|
+
| `wxmp_ai_digest` | 面向 AI 客户端的结构化图文摘要与高信号精选输出 |
|
|
82
|
+
| `wxmp_subscribe_album` | 免登录订阅微信公开合集页(零 `200013` 频控,支持文章页自动发现) |
|
|
83
|
+
| `wxmp_account_info` | 查询或校验单个公众号的主体认证、统计与可用状态 |
|
|
84
|
+
| `wxmp_blacklist` | 管理频控/无效黑名单(新增、移除、查看列表) |
|
|
85
|
+
| `wxmp_export_account` | 为指定公众号准备并生成 7 格式离线归档导出链接 |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## HTTP 接口路由
|
|
90
|
+
|
|
91
|
+
### JSON / API 路由(`/api/plugins/wxmp/*`)
|
|
92
|
+
|
|
93
|
+
| 路径 | 职责 |
|
|
94
|
+
| :--- | :--- |
|
|
95
|
+
| `/api/plugins/wxmp/login/status` | 获取当前登录态、Cookie 过期时间与账号池统计 |
|
|
96
|
+
| `/api/plugins/wxmp/login/start` | 初始化微信公众号后台扫码会话与轮询状态 |
|
|
97
|
+
| `/api/plugins/wxmp/login/logout` | 退出当前账号或移除指定账号会话 |
|
|
98
|
+
| `/api/plugins/wxmp/login/accounts` | 多账号凭证池列表、主账号切换与冷却状态管理 |
|
|
99
|
+
| `/api/plugins/wxmp/login/manual` | 手动导入凭证(Cookie / Token) |
|
|
100
|
+
| `/api/plugins/wxmp/search` | 搜索公众号(触发频控时给出明确错误码) |
|
|
101
|
+
| `/api/plugins/wxmp/subscribe` | 增删改订阅与设置分类标签 |
|
|
102
|
+
| `/api/plugins/wxmp/articles` | 本地文章列表检索与删除清理 |
|
|
103
|
+
| `/api/plugins/wxmp/sync` | 手动触发一次增量同步(`actions.sync`) |
|
|
104
|
+
| `/api/plugins/wxmp/hot` | 本地跨号热点排行与趋势快照分析 |
|
|
105
|
+
| `/api/plugins/wxmp/hot/discover` | 11 路公开源全网热文实时探测(支持强制刷新) |
|
|
106
|
+
| `/api/plugins/wxmp/hot/read` | 读取并解析公开探测热文全文内容 |
|
|
107
|
+
| `/api/plugins/wxmp/radar` | 关注词雷达规则管理与命中列表查询 |
|
|
108
|
+
| `/api/plugins/wxmp/briefing` | 获取结构化每日早报内容 |
|
|
109
|
+
| `/api/plugins/wxmp/packs` | 获取或一键导入预设领域订阅包 |
|
|
110
|
+
| `/api/plugins/wxmp/album/discover` | 从微信文章链接自动提取 `biz` 与可直连合集列表 |
|
|
111
|
+
| `/api/plugins/wxmp/album/subscribe` | 免登录订阅公开合集(`mp/appmsgalbum`) |
|
|
112
|
+
| `/api/plugins/wxmp/weread/cookie` | 读取、保存或清除可选微信读书备选 Cookie |
|
|
113
|
+
| `/api/plugins/wxmp/article` | 抓取或读取单篇文章完整 HTML / Markdown / 元数据 |
|
|
114
|
+
| `/api/plugins/wxmp/history` | 获取公众号历史抓取任务与批次记录 |
|
|
115
|
+
| `/api/plugins/wxmp/online/articles` | 在线预览公众号最新或指定偏移文章列表 |
|
|
116
|
+
| `/api/plugins/wxmp/account/info` | 查询公众号主体详情与认证状态 |
|
|
117
|
+
| `/api/plugins/wxmp/blacklist` | 黑名单查询、添加与移除 |
|
|
118
|
+
| `/api/plugins/wxmp/stats` | 获取存储后端类型、文章数、订阅数等运行指标 |
|
|
119
|
+
| `/api/plugins/wxmp/webhooks` | 管理 WeCom / Feishu / DingTalk / JSON Webhook 并支持测试推送 |
|
|
120
|
+
| `/api/plugins/wxmp/feed/articles.json` | 增量 JSON Feed(支持 `since` 游标与限制条数) |
|
|
121
|
+
|
|
122
|
+
### 静态 / 控制与流式输出端点(`web.register`)
|
|
123
|
+
|
|
124
|
+
| 路径 | 职责 |
|
|
125
|
+
| :--- | :--- |
|
|
126
|
+
| `/api/plugins/wxmp/login/qrcode` | 返回当前登录二维码图片流 |
|
|
127
|
+
| `/api/plugins/wxmp/subscriptions` | 导出 OPML / CSV / JSON 订阅清单 |
|
|
128
|
+
| `/api/plugins/wxmp/feed/article.md` | 按文章链接或 ID 输出纯 Markdown 文件 |
|
|
129
|
+
| `/api/plugins/wxmp/image` | 带 SSRF 白名单校验与防盗链 Referer 头的微信图片代理 |
|
|
130
|
+
| `/api/plugins/wxmp/rss/poll` | 查询定时轮询状态、立即执行轮询(`post`)或暂停/恢复(`pause` / `resume`) |
|
|
131
|
+
| `/api/plugins/wxmp/rss/*` | 单号 RSS (`/rss/<fakeid>.xml`) 与全量聚合 RSS (`/rss/all.xml`) |
|
|
132
|
+
| `/api/plugins/wxmp/export/*` | 基于一次性安全 Token 的 7 格式归档文件下载 |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 配置与存储
|
|
137
|
+
|
|
138
|
+
默认配置见 [cordis.patch.yml](./cordis.patch.yml):
|
|
139
|
+
|
|
140
|
+
```yaml
|
|
141
|
+
timeoutMs: 15000
|
|
142
|
+
rateLimitGlobalPerMin: 10
|
|
143
|
+
articleIntervalMs: 3000
|
|
144
|
+
cacheTtlMs: 60000
|
|
145
|
+
pollIntervalMs: 600000
|
|
146
|
+
pollLimit: 10
|
|
147
|
+
webhooks: []
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
持久化采用三层自动降级策略(均零强绑定外部运行依赖):
|
|
151
|
+
1. **DSH Storage Domain**(优先):对接 DSH 宿主持久化存储域。
|
|
152
|
+
2. **better-sqlite3**(次选):宿主环境可用时自动建库建表并自动迁移新列(如 `category`)。
|
|
153
|
+
3. **Memory Fallback**(兜底):无外部存储注入或测试环境下自动降级为内存存储,并支持运行时热升级。
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 测试验证
|
|
158
|
+
|
|
159
|
+
```powershell
|
|
160
|
+
# 1. 对全部 JS 源文件进行语法校验
|
|
161
|
+
Get-ChildItem packages/dsh-wxmp/*.js, packages/dsh-wxmp/lib/*.js | ForEach-Object {
|
|
162
|
+
node --check $_.FullName
|
|
163
|
+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
# 2. 运行全部自动化单测与端到端回归测试
|
|
167
|
+
node --test packages/dsh-wxmp/test/*.mjs
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## English Overview
|
|
173
|
+
|
|
174
|
+
`@hongmaple0820/dsh-wxmp` **v1.0.0** is a zero-dependency Digital Shell (DSH) workbench for tracking WeChat Official Accounts (`微信公众号`), public trend discovery, and offline content archiving.
|
|
175
|
+
|
|
176
|
+
### Highlights
|
|
177
|
+
|
|
178
|
+
- **Zero-Login / Zero-`200013` Album Direct Sync**: Subscribe directly to public WeChat albums (`mp.weixin.qq.com/mp/appmsgalbum`) without scanning a QR code or hitting WeChat MP rate limits. Paste any WeChat article link to automatically discover its account `biz` and linked albums.
|
|
179
|
+
- **Live Cross-Platform Trend Discovery**: Aggregates 11 public sources to surface trending tech/AI stories, topic cluster resonance, headline slot detection, and snapshot deltas (new / surging / persistent / cooling).
|
|
180
|
+
- **Watch Keyword Radar & Daily Briefing**: Word-boundary watch rules with unread badges, daily briefing synthesis, AI digest endpoints, and curated domain subscription packs.
|
|
181
|
+
- **Optional WeRead Fallback & Multi-Account Pool**: Rotates across multiple credentials with per-account `200013` cooldown isolation and optional WeRead cookie fallback when MP endpoints throttle.
|
|
182
|
+
- **Rich Output & Full Bilingual UI**: SSRF-safe `/api/plugins/wxmp/image` proxy, HTML-to-Markdown parser, 7 export formats (HTML / MD ZIP / JSON / XLSX / DOCX / EPUB / PDF), RSS 2.0 / OPML / CSV / Webhooks, and complete Chinese/English (`zh` / `en`) i18n with `<html lang>` auto-detection and topbar `EN / 中文` switcher.
|
package/bin/mcp.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { dirname, resolve } from 'node:path'
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
4
|
+
|
|
5
|
+
const dir = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
|
6
|
+
const mod = await import('@hongmaple0820/dsh-agent-pack/standalone').catch(() =>
|
|
7
|
+
import(pathToFileURL(resolve(dir, '..', 'dsh-agent-pack', 'lib', 'standalone.js')).href),
|
|
8
|
+
)
|
|
9
|
+
await mod.runStandalonePluginCli({ id: 'wxmp', dir })
|