Wechat Article Fetch logo

Wechat Article Fetch

Community
cat-xierluo
wechat-article-fetch

抓取微信公众号文章(mp.weixin.qq.com)到本地。当用户发来公众号链接要求"抓取""保存""存下来""归档""留痕""转成 Markdown"时使用。默认双产出:Markdown 整理版(供检索引用)+ HTML 原件保真归档(离线双击可读,供回溯核对)。默认 HTTP 直抓零依赖,失败自动切浏览器兜底。

Overview

Publishercat-xierluo
Repositorylegal-skills
Skill namewechat-article-fetch
Stars
722
Forks
109
Bundled files
4
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by cat-xierluo on GitHub. Read the source before you install it.

Installation

Install the Wechat Article Fetch AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/cat-xierluo/legal-skills/tree/main/skills/wechat-article-fetch
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/cat-xierluo/legal-skills.git /tmp/legal-skills
mkdir -p .claude/skills
cp -r /tmp/legal-skills/skills/wechat-article-fetch .claude/skills/wechat-article-fetch
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Wechat Article Fetch in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Wechat Article Fetch on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Wechat Article Fetch is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

微信公众号文章抓取工具

概述

抓取微信公众号文章到本地,默认一次产出两份:

产物用途特点
Markdown 整理版检索、引用、下游加工纯文本段落 + 图片本地化,自动过滤小装饰图
HTML 原件保真留痕、回溯核对完整页面 + 全部图片本地化(不过滤),离线双击可读,原外链保留在 data-src 备查

为什么两份都要:公众号分享链接常带 tempkey 临时凭证,过期后打不开;Markdown 整理会丢排版和配图,日后无法回溯核对原文。原件保真,整理版好用,两者互补不互替。

抓取引擎:

  • HTTP 直抓(默认主路线):微信文章是服务端渲染,正文与图片地址都在初始 HTML 里,直接请求即可。零依赖、速度快。
  • Playwright 浏览器兜底(--engine auto 自动切换):HTTP 路线失败或页面需要 JS 渲染时启用。

使用方法

bash
# 默认:双产出,保存到 skill 内 archive/<时间戳>_<标题>/
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx"

# 指定输出根目录(文章产物归入其下子目录)
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx" "./articles/"

# 兼容旧用法:直接指定 .md 文件路径(其余产物同目录平铺)
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx" "./articles/my-article.md"

# 只要 Markdown 整理版 / 只要 HTML 原件
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx" --mode markdown
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx" --mode archive

# 强制走浏览器(或只走 HTTP 不装 Playwright)
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx" --engine playwright
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx" --engine http

完整参数运行 node scripts/fetch.js --help 查看。

产物结构

archive/<YYYYMMDD_HHMMSS>_<文章标题>/
├── <文章标题>.md            # 整理版(头部注明原文链接与 HTML 原件位置)
├── <文章标题>.html          # 原件(src 已本地化,离线可读)
├── <文章标题>_assets/       # 整理版图片(智能过滤小装饰图)
└── <文章标题>_html_assets/  # 原件图片(全量保真,含小图标)

编程接口

javascript
import { fetchWechatArticle } from './scripts/fetch.js';

const report = await fetchWechatArticle("https://mp.weixin.qq.com/s/xxxxx", {
  engine: 'auto',        // 'auto' | 'http' | 'playwright'
  mode: 'both',          // 'both' | 'markdown' | 'archive'
  outputPath: null,      // 输出路径(可选)
  retries: 3             // Playwright 路线重试次数
});
// report: { title, url, engine, md, archive: { htmlPath, images, missing, remoteLeft, failed } }

抓取后检查(必做,不要跳过)

看脚本输出:

  • HTML 原件行首为 [OK ] 即归档完整;[警告] 时查看"缺失本地图"与"残留外链"两项
  • 残留外链只剩微信官方空白占位 pic_blank.gif 属正常,可忽略
  • Markdown 的图片统计里"失败"应为 0,过滤数是装饰图属正常
  • 页面报"该内容已被发布者删除""环境异常"等 → 链接失效,脚本会自动切换引擎重试;两条引擎都失败时不要再盲试链接

陷阱与要点

坑处理
tempkey 链接会过期收到就立刻抓,不要等"有空再存"
图片真地址在 data-src 不在 srcsrc 多为 base64 占位;脚本已处理,手工排查时注意
URL 属性里是 &amp; 不是 &解码后才能下载,否则 403;脚本已处理
图片域名不止 mmbiz.qpic.cn还有 mmecoa.qpic.cn 等,按 qpic.cn 后缀识别,别写死子域
wx_fmt 参数定扩展名微信图 URL 无 .jpg 后缀,靠 ?wx_fmt=jpeg 推断,PNG 不会存成 jpg 名
svg 小图标看着像 0KB原件目录里的几百字节装饰图标不是下载失败,别删(原件全量保真)
"环境异常"页引擎自动切换重试;仍失败说明链接失效或需验证

下游加工建议

抓取完成后,如内容为法律法规、裁判文书等结构化法律文本,可在汇报时提示用户:如需进一步格式化整理,可指定相应的格式化技能(若环境中有)继续处理。是否调用、调用哪个技能由用户或上层流程决定——本技能不自动调用、不绑定任何下游技能。

注意事项

⚠️ 仅用于个人学习和研究,请遵守网站服务条款 ⚠️ 频繁抓取可能被限流,建议控制请求频率 ⚠️ 抓取内容版权归原作者所有 ⚠️ Playwright 兜底路线首次使用会自动安装 chromium(npx playwright install chromium);HTTP 直抓路线零依赖

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Wechat Article Fetch AI skill do?

抓取微信公众号文章(mp.weixin.qq.com)到本地。当用户发来公众号链接要求"抓取""保存""存下来""归档""留痕""转成 Markdown"时使用。默认双产出:Markdown 整理版(供检索引用)+ HTML 原件保真归档(离线双击可读,供回溯核对)。默认 HTTP 直抓零依赖,失败自动切浏览器兜底。

Why use Wechat Article Fetch on TypingMind?

Because you install it once and use it with any model. Wechat Article Fetch is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Wechat Article Fetch in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/cat-xierluo/legal-skills/tree/main/skills/wechat-article-fetch. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Wechat Article Fetch?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Wechat Article Fetch?

As many as you like. As long as a model supports skills, you can use Wechat Article Fetch with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Wechat Article Fetch AI skill free?

It is published on GitHub by cat-xierluo. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇