当前位置: 首页 > Skill >

WeChat Article to Obsidian

WeChat Article to Obsidian

1.1.2 2026.11.20 浏览:922
获取Skill文件查看使用说明
作者:林川许可证:
本文目录展开

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 <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)
  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 <skill-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)

<skill-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="<skill-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 "<article_title>" 
  --target-path "<target_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:
    • <vault_disk_root>/<target_path>/<filename>.md
    • Example: <vault_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

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,014
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,014
Skill 文件
  • SKILL.md
    • WeChat Article → Obsidian
    • How it works
    • Dependencies
    • First-time setup
    • Configuration
      • Natural language override (per-request)
      • Config file (persistent default)
    • Workflow
      • Preferred execution strategy (important)
      • Single article
      • Batch save (multiple URLs)
    • Output format
    • Post-processing by Claude
    • Troubleshooting
      • curl returns empty, shell page, or parser finds no content
      • Playwright is missing
      • Policy block vs approval-required
      • Empty content / no #js_content
      • Parse step blocked by shell shape
      • obsidian CLI not available
  • 项目或源文件

相关 Skill

更多
Obsidian Search Obsidian Search 使用 AI 向量嵌入在 Obsidian 笔记中进行语义搜索,按含义查找笔记、发现关联、按标签/日期/文件夹筛选,并获取完整内容
Article Fetcher(文章抓取+Notion/Obsidian知识库存档) Article Fetcher(文章抓取+Notion/Obsidian知识库存档) 抓取微信公众号、小红书、豆瓣、知乎文章,自动上传OSS图片,LLM智能提取关键词,一键存档至Obsidian本地库(可选Notion)
Obsidian Bases Obsidian Bases 创建和编辑 Obsidian Bases(.base 文件),包含视图、过滤器、公式和摘要。用于处理 .base 文件并创建类似数据库的视图。
Obsidian工具箱(专业版) Obsidian工具箱(专业版) AI Agent的企业级Obsidian综合管理工具箱。批量操作、高级模板、插件深度集成、Canvas管理,复杂知识库一网打尽。
Obsidian Folder Sync Obsidian Folder Sync 将任意文件夹(支持任何 AI agent workspace)同步到 Obsidian Vault。 **触发场景**: - 用户说「同步到Obsidian」「备份到Obsidian」「Obsidian同步」「folder sync」 - 需要将任意文件夹(skills、memory、项目文档等)备份到 Obsi...