← 返回 Skills 市场
amortalsodyssey

WeChat Article to Obsidian

作者 Amo · GitHub ↗ · v1.1.2 · MIT-0
cross-platform ✓ 安全检测通过
148
总下载
0
收藏
1
当前安装
5
版本数
在 OpenClaw 中安装
/install wechat-article-to-obsidian
功能描述
Save WeChat public account articles (微信公众号文章) as clean Markdown notes in Obsidian. Use this skill whenever the user shares a mp.weixin.qq.com link and wants...
使用说明 (SKILL.md)

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 fetched with a two-stage strategy. First, try a normal curl with browser-like headers. If that only returns a shell page and the parser cannot find usable metadata / #js_content, fall back to a real browser fetch using Playwright + Chrome, extract the rendered article body, then convert it to clean Markdown and save it into Obsidian.

Dependencies

  • curl (pre-installed on macOS/Linux)
  • Node.js >= 18
  • Playwright + a Chromium/Chrome browser (only needed for fallback mode)
  • obsidian CLI (optional for vault-side workflows, not required for saving)

First-time setup

On first use, check \x3Cskill-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)
  2. "Where should I save WeChat articles by default?" — a path inside the vault (e.g., notes/wechat, articles/wechat)

Then write the answers to \x3Cskill-path>/config.json:

{
  "obsidian_vault": "MyVault",
  "default_path": "notes/wechat"
}

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)

\x3Cskill-path>/config.json:

  • obsidian_vault: the vault name for obsidian CLI
  • default_path: where to save articles when the user doesn't specify a path
  • vault_disk_root: absolute disk path of the vault root for direct-write saving

Recommended setup:

  • obsidian_vault: optional vault name reference
  • default_path: notes/wechat
  • vault_disk_root: absolute disk path to the user's Obsidian vault

Workflow

Preferred execution strategy (important)

Use a step-by-step workflow by default. Do not assume the one-line "fetch + parse + save" pattern is the most reliable option in OpenClaw.

Preferred order:

  1. Fetch HTML with fetch.sh
  2. Inspect metadata with parse.mjs --json
  3. Only if metadata/body is unusable, try browser fallback with Playwright
  4. Parse HTML into Markdown
  5. Save to Obsidian. For the publish build, use the bundled safe direct-write saver.

Why this matters:

  • some exec forms may be blocked by environment policy even when the underlying task is allowed
  • a blocked exec does not always mean a user approval can fix it
  • splitting the flow makes it much easier to identify whether the failure is in fetching, parsing, browser fallback, or vault writing

Single article

SKILL_PATH="\x3Cskill-path>"

# Step 1: Fetch HTML (fast path)
bash "$SKILL_PATH/scripts/fetch.sh" "URL" /tmp/wx_article.html

# Step 2: Inspect metadata
node "$SKILL_PATH/scripts/parse.mjs" /tmp/wx_article.html --json

# Step 3: If title/contentLength is empty or unusable, run browser fallback
python3 "$SKILL_PATH/scripts/fetch-browser.py" "URL" /tmp/wx_article.html
node "$SKILL_PATH/scripts/parse.mjs" /tmp/wx_article.html --json

# Step 4: Parse to Markdown
node "$SKILL_PATH/scripts/parse.mjs" /tmp/wx_article.html > /tmp/wx_article.md

# Step 5: Save with the bundled safe saver
node "$SKILL_PATH/scripts/save.mjs" \
  --markdown /tmp/wx_article.md \
  --config "$SKILL_PATH/config.json" \
  --title "\x3Carticle_title>" \
  --target-path "\x3Ctarget_path>"

The filename should be derived from the article title, keeping it readable: strip special characters, keep Chinese characters. Example: 从Claude Code源码看AI Agent工程架构.md

The bundled save.mjs uses a strict safe save path:

  • resolve output only under vault_disk_root
  • reject unsafe absolute paths and parent-directory traversal
  • create parent folders as needed
  • write the Markdown file directly inside the configured vault root

If shell redirection like > /tmp/wx_article.md is blocked by policy, use an equivalent alternate execution shape that still relies on the skill's own parser script, then save the resulting Markdown with the bundled direct-write saver.

Batch save (multiple URLs)

For 2+ URLs, process them sequentially. For 4+ URLs, consider using subagents in parallel (each with its own temp file).

# Per 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"
# Then save each to Obsidian

Output format

The parser produces clean Markdown with YAML frontmatter:

---
title: "Article Title"
author: "公众号名称"
publish_date: "2026-03-31 19:45:08"
saved_date: "2026-03-31"
source: "wechat"
url: "https://mp.weixin.qq.com/s/..."
---

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
  2. Verify the filename is clean and descriptive
  3. Confirm save location with the user if ambiguous
  4. When saving the final note, resolve the final path as:
    • \x3Cvault_disk_root>/\x3Ctarget_path>/\x3Cfilename>.md
    • Example: \x3Cvault_disk_root>/notes/wechat/文章名.md
    • Do not prepend extra app-specific subfolders like humanlike/ unless the user explicitly asked for that vault subdirectory

Troubleshooting

curl returns empty, shell page, or parser finds no content

Try the browser fallback:

python3 "$SKILL_PATH/scripts/fetch-browser.py" "URL" /tmp/wx_article.html

If browser fallback also fails, the article may require a stronger logged-in context or be a special unsupported page type.

Playwright is missing

If browser fallback fails with missing Playwright modules (for example ModuleNotFoundError: No module named 'playwright'), do not block the whole workflow.

Do this instead:

  1. Keep the normal fetch.sh path as the default first attempt
  2. Only report Playwright as a missing optional dependency for fallback mode
  3. Continue with non-browser flow if the fast path already produced usable article HTML
  4. If the user wants, help install Playwright globally/local to improve future fallback success

Policy block vs approval-required

These are different situations and must be treated differently:

  • Approval-required: the system created an approval object and the user can explicitly approve that exact command
  • Policy-blocked at entry: the command is rejected before an approval object exists

Do not assume every blocked command can be fixed with an approval command. If there is no actual approval object from the runtime, explain that clearly and switch to a different execution shape.

Empty content / no #js_content

Some special article types (mini-programs, video-only) aren't supported. Inform the user.

Parse step blocked by shell shape

If a direct command like:

node "$SKILL_PATH/scripts/parse.mjs" /tmp/wx_article.html > /tmp/wx_article.md

is blocked by policy, do not abandon the skill. Use another execution form that still calls the same parser script and captures its stdout, then save the Markdown with the bundled direct-write saver.

obsidian CLI not available

That is fine. The publish build saves by direct file write to the configured vault disk path.

Important for this setup:

  • direct-write saving should use vault_disk_root from config when present
  • notes/wechat should resolve inside the configured vault root
  • do not prepend extra app-specific subfolders unless the user explicitly asked for them
安全使用建议
This skill appears coherent and implements exactly what it promises. Before installing: 1) Ensure you only set vault_disk_root to a folder you explicitly want the skill to write into (it enforces staying inside the vault root, but the path is still user-provided). 2) Be aware Playwright (if used) will require additional packages and may download Chromium binaries on first run; adjust the Python shebang (scripts/fetch-browser.py) or run it with your system python if the bundled path doesn't exist. 3) Review and confirm the skill's config.json once it writes it, and test with a non-sensitive vault/folder first. 4) If you want extra protection, run the scripts in a sandbox or restrict the agent's ability to invoke the skill autonomously; otherwise the agent could save files to the configured vault when triggered by matching inputs.
功能分析
Type: OpenClaw Skill Name: wechat-article-to-obsidian Version: 1.1.2 The skill bundle is a legitimate utility designed to fetch WeChat articles and save them as Markdown in an Obsidian vault. It employs a two-stage fetching process (curl and Playwright) and includes a dedicated parser (scripts/parse.mjs) and a security-conscious saver (scripts/save.mjs). The saver script explicitly implements path sanitization and directory traversal protection to ensure files are only written within the user-configured vault root, demonstrating good security practices rather than malicious intent.
能力评估
Purpose & Capability
Name/description match the actual code and runtime instructions. The scripts implement fetching (curl + optional Playwright fallback), parsing to Markdown, and safe direct-write saving to an Obsidian vault. No unrelated credentials, cloud APIs, or binaries are required.
Instruction Scope
SKILL.md and the scripts only read the provided article URL(s), temporary files, and the skill's config.json, and then write Markdown into the user's configured vault root. The browser fallback uses Playwright to evaluate page DOM and embed the article content; no external tracking or remote exfil endpoints are present in the scripts. The skill does instruct the agent to write persistent config to <skill-path>/config.json and to write notes into vault_disk_root (user-supplied).
Install Mechanism
This is instruction-only (no packaged installer). Dependencies are Node >=18, curl, and optionally Playwright + a Chromium/Chrome runtime. Playwright itself typically downloads browser binaries at first-run; the scripts attempt to require-playwright from local or global installs but do not fetch arbitrary code from unknown URLs. The Python fallback script uses a hardcoded Homebrew Python shebang which is non-portable and may require adjustment on some systems.
Credentials
The skill requests no environment variables or secrets. The only persistent configuration is a user-supplied vault path and default save location (config.json). These are reasonable and proportional to the stated task of saving notes to an on-disk Obsidian vault.
Persistence & Privilege
always:false (normal). The skill writes a per-skill config.json in its own path and can perform direct writes into a user-specified vault_disk_root. This is expected behavior for a clipping/save-to-vault skill but means the agent—if allowed to run the skill autonomously—can create files in the configured vault without an additional prompt. There is no evidence the skill alters other skills or system-wide settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install wechat-article-to-obsidian
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /wechat-article-to-obsidian 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.2
Security hardening for publish build: removed child_process-based save flow, removed machine-specific absolute paths, kept safe vault-bound direct-write saving, and cleaned docs/config for public distribution.
v1.1.1
Security fix: replace unsafe shell-based save flow with a safe saver that prefers Obsidian CLI first and direct-write fallback second, with path sanitization and vault-boundary checks.
v1.1.0
Add save.mjs: full pipeline now closes the loop (fetch→parse→save). No more relying on agent to handle the last step.
v1.0.1
Fix: remove hardcoded vault config, use empty template
v1.0.0
Initial release: save WeChat MP articles as clean Markdown in Obsidian
元数据
Slug wechat-article-to-obsidian
版本 1.1.2
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 5
常见问题

WeChat Article to Obsidian 是什么?

Save WeChat public account articles (微信公众号文章) as clean Markdown notes in Obsidian. Use this skill whenever the user shares a mp.weixin.qq.com link and wants... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 148 次。

如何安装 WeChat Article to Obsidian?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install wechat-article-to-obsidian」即可一键安装,无需额外配置。

WeChat Article to Obsidian 是免费的吗?

是的,WeChat Article to Obsidian 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

WeChat Article to Obsidian 支持哪些平台?

WeChat Article to Obsidian 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 WeChat Article to Obsidian?

由 Amo(@amortalsodyssey)开发并维护,当前版本 v1.1.2。

💬 留言讨论