WeChat Article Extractor
Extract WeChat public account articles to clean Markdown. WeChat blocks headless browsers (环境异常 CAPTCHA) and web_fetch gets empty JS-rendered pages, so the reliable approach is: find a mirror on aggregator sites, then extract content.
Scope & Boundaries
This skill handles:
- - Extracting article text, images, and metadata from WeChat article URLs
- Finding mirror copies when direct access is blocked
- Converting HTML to clean Markdown
- Saving output as
.md files
This skill does NOT handle:
- - Publishing or syncing to note-taking apps (that's the user's workflow)
- Batch extraction of multiple articles (handle one at a time)
- WeChat login, authentication, or account management
- Translating article content
Inputs
| Input | Required | Description |
|---|
| WeChat URL | Yes | An mp.weixin.qq.com link |
| Output filename |
No | Defaults to kebab-case of article title |
| Save location | No | Defaults to
/tmp/ |
Outputs
- - A Markdown file with full article content, images, and metadata header
- Console confirmation with file path and character count
Workflow
Step 1 — Try direct fetch (fast path)
CODEBLOCK0
Success check: If result rawLength > 500 AND content has real paragraphs (not just nav/footer text) → skip to Step 4 Option B.
Failure indicators: rawLength < 500, content is navigation/boilerplate only, or contains "环境异常" → go to Step 2.
Step 2 — Extract article metadata
From the URL or any partial content, identify:
- - Article title (from
<title> or og:title) - Author / account name (from og:description or page content)
If metadata is unavailable from the URL, ask the user for the article title.
Step 3 — Search for mirrors
CODEBLOCK1
Mirror site priority (ranked by content quality and reliability):
- 1. 53ai.com — full content, reliable formatting
- mp.ofweek.com — tech articles
- juejin.cn — developer content
- woshipm.com — product/business content
- 36kr.com — tech/business news
If title is unknown, try: INLINECODE7
If no mirrors found: Try the Chrome Extension Relay fallback (see Fallback section).
Step 4 — Download and extract
Option A — Mirror found:
curl -s -L "<mirror_url>" -o /tmp/wechat-article.html
Verify file size > 10KB (smaller usually means redirect/error page).
Run the extraction script:
CODEBLOCK3
Replace <skill_dir> with the directory containing this SKILL.md.
Option B — Direct fetch succeeded (Step 1):
Format the fetched markdown with the header template below.
Step 5 — Verify output quality
Check the output file:
- - Has a title (not "WeChat Article")
- Has multiple paragraphs of real content
- Images have valid URLs (not broken/placeholder)
- No excessive HTML artifacts remaining
If output looks truncated or garbled, try a different mirror site (return to Step 3).
Step 6 — Deliver to user
Report:
- - File saved at: INLINECODE9
- Title: INLINECODE10
- Size:
<char count> characters - Image count:
<N> images
If the user wants it saved to a specific location (e.g., Obsidian), follow their instructions for the final copy.
Markdown Header Template
Every extracted article must include this header:
CODEBLOCK4
Fields that cannot be determined should be omitted (don't write "Unknown").
Fallback: Chrome Extension Relay
If no mirror exists (very new or niche article):
Tell the user (in Chinese if they wrote in Chinese):
"没有找到镜像。请在 Chrome 中打开这篇文章,然后点击 OpenClaw Browser Relay 扩展图标(badge 亮起),我就能直接读取内容。"
Then use:
browser(action="snapshot", profile="chrome")
Extract content from the snapshot and format with the header template.
Error Handling
| Problem | Detection | Action |
|---|
| WeChat blocks access | rawLength < 500 or "环境异常" | Search for mirrors (Step 3) |
| No mirrors found |
Search returns 0 relevant results | Try Chrome Relay fallback |
| Mirror content truncated | Output < 1000 chars when original is long | Try next mirror site |
| Script extraction fails | Python error or empty output | Fall back to
web_fetch on mirror URL |
| Images broken | Image URLs return 404 | Note in output; images may expire |
Success Criteria
- - Output Markdown contains the full article text (not truncated)
- Title and metadata are correctly extracted
- Images are preserved with working URLs
- No HTML artifacts or navigation junk in output
- File is saved at the specified location
Notes
- - WeChat image URLs from mirrors (e.g., api.ibos.cn proxy) are generally valid and render in most Markdown viewers
- Mirror sites typically publish within minutes of the original
- The
· · · section dividers are WeChat style — preserve them - For very long articles (>50K chars), the script handles them fine but
web_fetch may truncate
Configuration
No persistent configuration required. The skill uses standard OpenClaw tools (web_fetch, web_search, exec) and optionally browser for the Chrome Relay fallback.
Required tools:
| Tool | Purpose |
|---|
| INLINECODE20 | Direct article fetch attempt |
| INLINECODE21 |
Mirror site discovery |
|
exec | Run curl and Python extraction script |
Optional tools:
| Tool | Purpose |
|---|
| INLINECODE23 | Chrome Extension Relay fallback |
System dependencies:
| Dependency | Purpose |
|---|
| Python 3.8+ | Extraction script |
| curl |
Mirror page download |
WeChat Article Extractor
提取微信公众号文章并转换为干净的 Markdown 格式。微信会屏蔽无头浏览器(环境异常验证码),而 web_fetch 获取到的 JS 渲染页面为空,因此可靠的方法是:在聚合站点上找到镜像,然后提取内容。
范围与边界
本技能处理:
- - 从微信公众号文章 URL 中提取文章文本、图片和元数据
- 在直接访问被屏蔽时查找镜像副本
- 将 HTML 转换为干净的 Markdown
- 将输出保存为 .md 文件
本技能不处理:
- - 发布或同步到笔记应用(这是用户的工作流程)
- 批量提取多篇文章(一次处理一篇)
- 微信登录、认证或账户管理
- 翻译文章内容
输入
| 输入 | 必需 | 描述 |
|---|
| 微信 URL | 是 | 一个 mp.weixin.qq.com 链接 |
| 输出文件名 |
否 | 默认为文章标题的短横线命名格式 |
| 保存位置 | 否 | 默认为 /tmp/ |
输出
- - 一个包含完整文章内容、图片和元数据头部的 Markdown 文件
- 控制台确认信息,包含文件路径和字符数
工作流程
第 1 步 — 尝试直接获取(快速路径)
web_fetch(url, extractMode=markdown, maxChars=50000)
成功检查: 如果结果 rawLength > 500 且内容包含真实段落(不仅仅是导航或页脚文本)→ 跳转到第 4 步选项 B。
失败指标: rawLength < 500,内容仅为导航/样板文字,或包含环境异常→ 进入第 2 步。
第 2 步 — 提取文章元数据
从 URL 或任何部分内容中识别:
- - 文章标题(来自 或 og:title)
- 作者/公众号名称(来自 og:description 或页面内容)
如果无法从 URL 获取元数据,请向用户询问文章标题。
第 3 步 — 搜索镜像
web_search(<文章标题> <作者/公众号名称>)
镜像站点优先级(按内容质量和可靠性排序):
- 1. 53ai.com — 完整内容,格式可靠
- mp.ofweek.com — 科技文章
- juejin.cn — 开发者内容
- woshipm.com — 产品/商业内容
- 36kr.com — 科技/商业新闻
如果标题未知,尝试:web_search(site:53ai.com )
如果未找到镜像: 尝试 Chrome 扩展中继回退方案(参见回退方案部分)。
第 4 步 — 下载并提取
选项 A — 找到镜像:
bash
curl -s -L <镜像_url> -o /tmp/wechat-article.html
验证文件大小 > 10KB(更小通常意味着重定向或错误页面)。
运行提取脚本:
bash
python3 dir>/scripts/extractwechat.py /tmp/wechat-article.html /tmp/<输出文件名>.md
将 替换为包含此 SKILL.md 的目录。
选项 B — 直接获取成功(第 1 步):
使用下面的头部模板格式化获取到的 Markdown。
第 5 步 — 验证输出质量
检查输出文件:
- - 有标题(不是WeChat Article)
- 包含多个真实内容段落
- 图片有有效 URL(不是损坏或占位符)
- 没有多余的 HTML 残留
如果输出看起来被截断或乱码,尝试不同的镜像站点(返回第 3 步)。
第 6 步 — 交付给用户
报告:
- - 文件保存位置:<路径>
- 标题:<标题>
- 大小:<字符数> 个字符
- 图片数量: 张图片
如果用户希望保存到特定位置(例如 Obsidian),按照他们的指示进行最终复制。
Markdown 头部模板
每篇提取的文章必须包含此头部:
markdown
<标题>
作者: <作者>
来源: 微信公众号「<公众号名称>」
日期: <日期>
原文: <原始微信URL>
摘要: <从内容生成的 1-2 句摘要>
无法确定的字段应省略(不要写未知)。
回退方案:Chrome 扩展中继
如果没有镜像(非常新或小众的文章):
告诉用户(如果用户用中文写作则用中文回复):
没有找到镜像。请在 Chrome 中打开这篇文章,然后点击 OpenClaw Browser Relay 扩展图标(badge 亮起),我就能直接读取内容。
然后使用:
browser(action=snapshot, profile=chrome)
从快照中提取内容并使用头部模板格式化。
错误处理
| 问题 | 检测方式 | 操作 |
|---|
| 微信屏蔽访问 | rawLength < 500 或环境异常 | 搜索镜像(第 3 步) |
| 未找到镜像 |
搜索返回 0 个相关结果 | 尝试 Chrome 中继回退方案 |
| 镜像内容截断 | 原文较长时输出 < 1000 字符 | 尝试下一个镜像站点 |
| 脚本提取失败 | Python 错误或空输出 | 回退到在镜像 URL 上使用 web_fetch |
| 图片损坏 | 图片 URL 返回 404 | 在输出中注明;图片可能过期 |
成功标准
- - 输出的 Markdown 包含完整文章文本(未被截断)
- 标题和元数据正确提取
- 图片保留且 URL 有效
- 输出中没有 HTML 残留或导航垃圾
- 文件保存到指定位置
备注
- - 来自镜像的微信图片 URL(例如 api.ibos.cn 代理)通常有效,可在大多数 Markdown 查看器中渲染
- 镜像站点通常在原文发布后几分钟内发布
- · · · 分段线是微信风格——保留它们
- 对于非常长的文章(>50K 字符),脚本可以正常处理,但 web_fetch 可能会截断
配置
无需持久化配置。本技能使用标准 OpenClaw 工具(webfetch、websearch、exec),并可选择使用 browser 进行 Chrome 中继回退。
必需工具:
| 工具 | 用途 |
|---|
| webfetch | 直接获取文章尝试 |
| websearch |
镜像站点发现 |
| exec | 运行 curl 和 Python 提取脚本 |
可选工具:
| 工具 | 用途 |
|---|
| browser | Chrome 扩展中继回退方案 |
系统依赖:
镜像页面下载 |