SuperAPI AI Directory

yy-wechat-to-markdown

Office & productivity

View repository

Updated 10-16 08:34

About this skill

yy-wechat-to-markdown

Description

Convert WeChat Official Account article links to Markdown format, extract the title, author, and body content, and generate a Markdown file with YAML frontmatter.

Use Cases

  • The user provides a WeChat Official Account article link and requests conversion to Markdown
  • Need to save a WeChat Official Account article as a local Markdown file
  • Need to extract WeChat article content for archiving or editing

Should not trigger:

  • Conversion of links on non-WeChat Official Account domains
  • The user only needs to extract plain text and does not request format conversion
  • Paid articles that require login to access

Instructions

Step 1. Validate the input link

Check whether it is a link on the mp.weixin.qq.com domain.

Decision branch:

  • Valid WeChat link: proceed to Step 2
  • Non-WeChat link: indicate that only WeChat Official Account article links are supported, and exit execution

Step 2. Choose the execution method and obtain the content

Decision branch:

  • Script available(scripts/package.json exists and Node.js >= 22.18.0 is available): use the script to perform the conversion, and proceed directly to Step 4

    node scripts/ <url> [output-path]
    
  • Script unavailable: manually fetch the web page content, and proceed to Step 3

Decision branch when the script is unavailable:

  • Request successful: proceed to Step 3
  • Request failed: output the error status code and reason, and exit execution

Step 3. Manually extract information and convert

Perform this step only when the script is unavailable in Step 2.

  1. Extract the article title and author/Official Account name
  2. Extract js_content the body HTML of the region
  3. Convert HTML tags to Markdown format (headings, bold, lists, quotes, code blocks, links, images, etc.)
  4. Automatically handle WeChat lazy-loaded images (data-src) and HTML entity escaping

Decision branch:

  • Body extraction successful: proceed to Step 4
  • Body empty: indicate that it may be a paid article or require login, and exit execution

Step 4. Output the result

Assemble the complete Markdown (including YAML frontmatter: title, author, source, date).

Decision branch:

  • User specifies an output path: save as a file, and output the save location and character statistics
  • User does not specify a path: output the Markdown text directly

Related Resources

This skill includes the following auxiliary resources:

  • scripts/src/cli.ts: CLI entry script
  • scripts/src/parser/html-to-md.ts: HTML to Markdown module
  • scripts/src/parser/extract-meta.ts: article metadata extraction module
  • scripts/src/parser/extract-body.ts: body region extraction module