SuperAPI AI Directory

weixin-article-to-obsidian-cn

Writing & research

View repository

Updated 10-16 08:08

About this skill

WeChat official account article to Obsidian

Overview

Save a WeChat official account article as a Markdown document in the Obsidian vault, and download the body images to a local assets directory. The flow prioritizes using opencli weixin download to fetch the body, then parses the page source to fill in images and article metadata for long-image articles.

When to use

Use this skill when the user requests the following:

  • Provide an mp.weixin.qq.com article link
  • Wants to save the WeChat official account article body as a Markdown note
  • Wants to download the article images locally instead of keeping remote CDN links
  • Wants to use Obsidian image wikilinks, for example ![[assets/标题/图片.png]]
  • Wants to make this kind of WeChat official account clipping flow a repeatable operation

Do not use

This skill should not be used in the following scenarios:

  • The link is not a WeChat official account article
  • The user only wants to extract the article's visual style or layout theme
  • The user wants to publish Markdown back to a WeChat official account
  • The target is not local Markdown or an Obsidian vault

Usage instructions

  1. First read the target vault rules, focusing on confirming document categories, image assets directories, and index maintenance requirements.
  2. Choose a semantic directory based on the article topic. If the vault already has a more specific category, do not default to a generic clipping directory.
  3. If this machine has opencli, run first:
opencli weixin download --url "https://mp.weixin.qq.com/s/example" --output /tmp/weixin-article --download-images true -f yaml
  1. If opencli did not capture all images, or the article is a long-image page, run this skill's script:
python3 scripts/download_weixin_article.py "https://mp.weixin.qq.com/s/example" \
  --vault-root /path/to/obsidian-vault \
  --target-dir "FrontEnd/安全"
  1. Check the generated Markdown and remove leftover content such as platform buttons, recommended reading, rewards, and duplicate metadata.
  2. Confirm that all image references point to local files under assets/<文档标题>/ and use Obsidian wikilink syntax.
  3. If the vault requires maintaining topic indexes, add the new document to the corresponding index page as a wiki link.

Script behavior

scripts/download_weixin_article.py performs the following operations:

  • First tries opencli weixin download, reusing its Markdown body when the body is sufficiently complete
  • Directly fetches the article HTML as a fallback or supplement
  • Extracts the title, official account name, publication time, body summary, and long-image article image URLs
  • Downloads images to assets/<安全标题>/
  • Writes Markdown to the specified --target-dir
  • Outputs a JSON summary containing the document path, assets directory, image count, and whether opencli was run

Common parameters:

  • --vault-root: Obsidian vault root directory, defaults to the current directory.
  • --target-dir: Relative document directory within the vault, defaults to the vault root directory.
  • --title: Overrides the automatically extracted title, and also affects the assets directory name.
  • --locale: Metadata tag language, options are zh or en, defaults to zh。
  • --overwrite: Allows overwriting a Markdown document with the same name.

Output rules

  • Place Markdown under a semantically correct content directory.
  • Place images under assets/<文档标题>/ in the vault root directory.
  • Image references use Obsidian wikilink syntax, not regular Markdown image syntax.
  • Keep the original article link line by default, unless the user explicitly asks to remove it.
  • Do not proactively add YAML frontmatter unless the target knowledge base already has this requirement.

Checklist

  • The document has appeared in the selected directory.
  • The resource directory exists and contains the expected number of article images.
  • rg "mmbiz|data:image|http" <文档> Only the original text link remains, with no remote image references.
  • The image reference format is ![[assets/...]]。
  • When the target knowledge base requires indexing, the corresponding topic index has been updated.