WeChat Article → Obsidian
Save WeChat MP articles (微信公众号) as clean Markdown notes in Obsidian. No browser, no CDP, no plugins needed.
How it works
WeChat articles are server-side rendered — the full content is in the HTML, just CSS-hidden. A curl with browser UA fetches it, a Node.js script converts it to clean Markdown (with images, merged section headings, promotional tails stripped), and the result goes into the user's Obsidian vault via the obsidian CLI.
Dependencies
- - curl (pre-installed on macOS/Linux)
- Node.js >= 18
- obsidian CLI (for writing to vault — if not available, fall back to direct file write)
First-time setup
On first use, check <skill-path>/config.json. If obsidian_vault or default_path is empty, ask the user:
- 1. "What is your Obsidian vault name?" — this is the vault name used with
obsidian CLI (e.g., vault=MyVault) - "Where should I save WeChat articles by default?" — a path inside the vault (e.g.,
notes/wechat, articles/wechat)
Then write the answers to <skill-path>/config.json:
CODEBLOCK0
This only needs to happen once. After that, the skill uses the saved config automatically.
Configuration
Natural language override (per-request)
The user can override the default path anytime:
- - "把这篇文章存到 reading/tech 目录"
- "save this under articles/ai/"
- "导入到 Obsidian 的 inbox 文件夹"
Parse the target path from the user's message and use it instead of default_path.
Config file (persistent default)
INLINECODE11 :
- -
obsidian_vault: the vault name for obsidian CLI - INLINECODE14 : where to save articles when the user doesn't specify a path
Workflow
Single article
CODEBLOCK1
The save script automatically:
- - Reads
config.json for vault name and default path - Derives filename from the YAML frontmatter title
- Tries
obsidian CLI first, falls back to direct file write if CLI is not available
Batch save (multiple URLs)
For 2+ URLs, process them sequentially. For 4+ URLs, consider using subagents in parallel (each with its own temp file).
CODEBLOCK2
Output format
The parser produces clean Markdown with YAML frontmatter:
CODEBLOCK3
The parser automatically:
- - Preserves all article images (WeChat CDN URLs)
- Removes WeChat decoration text (THUMB, STOPPING)
- Merges "PART.XX" + title into proper
## PART.XX Title headings - Strips promotional tails (关注/点赞/在看, author bios, QR codes)
- Preserves bold, italic, code blocks, blockquotes, lists, links
Post-processing by Claude
After the parser runs, review the output and apply any remaining cleanup:
- 1. If the user specified tags, add them to the frontmatter
- Verify the filename is clean and descriptive
- Confirm save location with the user if ambiguous
Troubleshooting
curl returns empty or verification page
WeChat may rate-limit. Wait 30 seconds and retry. If persistent, the article may require login — inform the user.
Empty content / no #js_content
Some special article types (mini-programs, video-only) aren't supported. Inform the user.
obsidian CLI not available
Fall back to direct file write using the Write tool to the vault's disk path.
微信公众号文章 → Obsidian
将微信公众号文章保存为干净的Markdown笔记到Obsidian中。无需浏览器、无需CDP、无需插件。
工作原理
微信公众号文章是服务端渲染的——完整内容就在HTML中,只是被CSS隐藏了。使用带有浏览器UA的curl获取内容,Node.js脚本将其转换为干净的Markdown(包含图片、合并章节标题、去除推广尾缀),结果通过obsidian CLI写入用户的Obsidian仓库。
依赖项
- - curl(macOS/Linux预装)
- Node.js >= 18
- obsidian CLI(用于写入仓库——如果不可用,则回退到直接文件写入)
首次设置
首次使用时,检查/config.json。如果obsidianvault或defaultpath为空,询问用户:
- 1. 你的Obsidian仓库名称是什么?——这是与obsidian CLI一起使用的仓库名称(例如vault=MyVault)
- 默认将微信公众号文章保存在哪里?——仓库内的路径(例如notes/wechat、articles/wechat)
然后将答案写入/config.json:
json
{
obsidian_vault: MyVault,
default_path: notes/wechat
}
这只需要执行一次。之后,该技能会自动使用保存的配置。
配置
自然语言覆盖(每次请求)
用户可以随时覆盖默认路径:
- - 把这篇文章存到 reading/tech 目录
- save this under articles/ai/
- 导入到 Obsidian 的 inbox 文件夹
从用户消息中解析目标路径,并使用它替代default_path。
配置文件(持久化默认值)
/config.json:
- - obsidianvault:用于obsidian CLI的仓库名称
- defaultpath:当用户未指定路径时保存文章的默认位置
工作流程
单篇文章
bash
SKILL_PATH=
步骤1:获取HTML
bash $SKILL
PATH/scripts/fetch.sh URL /tmp/wxarticle.html
步骤2:解析为Markdown
node $SKILL
PATH/scripts/parse.mjs /tmp/wxarticle.html > /tmp/wx_article.md
步骤3:保存到Obsidian(自动读取config.json)
node $SKILL
PATH/scripts/save.mjs /tmp/wxarticle.md
或者保存到指定路径(覆盖default_path):
node $SKILL
PATH/scripts/save.mjs /tmp/wxarticle.md --path reading/tech
保存脚本会自动:
- - 读取config.json获取仓库名称和默认路径
- 从YAML前置元数据的标题中推导文件名
- 优先尝试obsidian CLI,如果CLI不可用则回退到直接文件写入
批量保存(多个URL)
对于2个及以上URL,按顺序处理。对于4个及以上URL,考虑使用子代理并行处理(每个代理使用自己的临时文件)。
bash
每个URL:
bash $SKILL
PATH/scripts/fetch.sh $url /tmp/wx${i}.html
node $SKILL
PATH/scripts/parse.mjs /tmp/wx${i}.html > /tmp/wx_${i}.md
然后将每个文件保存到Obsidian
输出格式
解析器生成带有YAML前置元数据的干净Markdown:
yaml
title: 文章标题
author: 公众号名称
publish_date: 2026-03-31 19:45:08
saved_date: 2026-03-31
source: wechat
url: https://mp.weixin.qq.com/s/...
解析器会自动:
- - 保留所有文章图片(微信公众号CDN链接)
- 移除微信公众号装饰文字(THUMB、STOPPING)
- 将PART.XX + 标题合并为正确的## PART.XX 标题格式
- 去除推广尾缀(关注/点赞/在看、作者简介、二维码)
- 保留粗体、斜体、代码块、引用、列表、链接
Claude的后处理
解析器运行后,检查输出并进行任何剩余的清理工作:
- 1. 如果用户指定了标签,将其添加到前置元数据中
- 验证文件名是否清晰且具有描述性
- 如果路径不明确,与用户确认保存位置
故障排除
curl返回空内容或验证页面
微信公众号可能进行限速。等待30秒后重试。如果持续出现,文章可能需要登录——告知用户。
内容为空/没有#js_content
某些特殊文章类型(小程序、纯视频)不受支持。告知用户。
obsidian CLI不可用
使用写入工具回退到直接文件写入,写入仓库的磁盘路径。