From legal-skills
抓取微信公众号文章内容,使用 Playwright headless 模式无弹窗后台抓取,支持动态加载内容,自动提取标题和正文并保存为 Markdown 文件。本技能应在用户需要抓取微信公众号文章内容时使用。检测到法律内容且项目中存在 legal-text-format 时自动链式调用格式化。默认保存到 skill 内部 archive 目录。
npx claudepluginhub cat-xierluo/legal-skills --plugin minimax-image-understandThis skill uses the workspace's default tool permissions.
使用 Playwright 抓取微信公众号文章,后台运行无弹窗,自动处理动态加载,提取干净的文章内容,并支持自动保存为 Markdown 文件。
Reads public URLs into clean Markdown using platform-aware fallbacks for Chinese sites (WeChat, Zhihu, Bilibili), X/Twitter, and generic web pages via Jina Reader, Camoufox, WebFetch, and Playwright.
Fetches any URL or PDF as clean Markdown, handling paywalls, JS-heavy pages, Twitter/X, and Chinese platforms via proxy cascade. Saves to ~/Downloads; prefer over WebFetch.
Publishes Markdown or HTML articles to WeChat Official Account drafts via Python API scripts, with account listing and format conversion.
Share bugs, ideas, or general feedback.
使用 Playwright 抓取微信公众号文章,后台运行无弹窗,自动处理动态加载,提取干净的文章内容,并支持自动保存为 Markdown 文件。
本节为必须遵守的执行指令,而非可选建议。
完成抓取后,你必须立即按以下清单判定内容是否为法律文本。满足任意一条即为法律内容:
(202X)XX民初XX号)、法院名称、法律条文引用(如 第X条第X款)以下两个条件同时满足时,必须立即调用 legal-text-format,不询问用户确认:
skills/legal-text-format/SKILL.md(通过 ls skills/legal-text-format/SKILL.md 或等效方式检查)条件满足时,按以下顺序执行:
archive/ 目录skills/legal-text-format/SKILL.md 是否存在legal-text-format 技能,传入抓取到的文件路径作为输入如果 legal-text-format 不存在:正常结束抓取流程,在汇报中附加提示:
已检测到法律内容,但项目中未安装
legal-text-format格式化技能。如需自动格式化,可通过 skill-manager 安装。
archive/ 目录(默认行为不变)legal-text-format 的 archive/ 目录(由该技能自行管理)仅抓取(非法律内容,或 legal-text-format 未安装):
已完成抓取:{标题} 保存位置:{文件路径}
抓取 + 格式化(法律内容且 legal-text-format 已安装):
已完成抓取 + 法律格式化:{标题} 原始内容:{wechat-article-fetch archive 路径} 格式化内容:{legal-text-format archive 路径} 文本类型:{法律条文/法律案例}
// 抓取文章(仅返回结果)
const result = await fetchWechatArticle("https://mp.weixin.qq.com/s/xxxxx");
// 抓取文章并自动保存为 Markdown 文件
const result = await fetchWechatArticle(
"https://mp.weixin.qq.com/s/xxxxx",
3, // 重试次数(可选)
"./output.md" // 保存路径(可选)
);
// 返回格式
{
title: "文章标题",
content: "文章正文...",
url: "文章URL"
}
# 基本用法(仅输出到控制台)
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx"
# 保存为指定文件
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx" "./articles/my-article.md"
# 保存到目录(自动使用文章标题作为文件名)
node scripts/fetch.js "https://mp.weixin.qq.com/s/xxxxx" "./articles/"
标题: 文章标题
文章正文第一段...
文章正文第二段...
# 文章标题
> 原文链接: https://mp.weixin.qq.com/s/xxxxx
> 抓取时间: 2026-01-21 20:30:00
---
文章正文第一段...

文章正文第二段...
当文章包含图片时,会自动生成以下文件结构:
输出目录/
├── 文章标题.md # Markdown 文件
└── 文章标题_assets/ # 图片资源文件夹
├── image_xxx_0.jpg
├── image_xxx_1.jpg
└── ...
默认启用智能图片筛选,自动过滤小于 15KB 的装饰性图片(如社交媒体按钮、表情符号等)。
可以在 scripts/fetch.js 中修改筛选配置:
const IMAGE_FILTER_CONFIG = {
minFileSize: 15 * 1024, // 最小文件大小(字节)
enabled: true // 是否启用筛选
};
npx playwright install chromium)#js_content或 .rich_media_content区域cmd.exe 运行 npx 命令const urls = [
"https://mp.weixin.qq.com/s/xxxx1",
"https://mp.weixin.qq.com/s/xxxx2",
"https://mp.weixin.qq.com/s/xxxx3"
];
for (const url of urls) {
const result = await fetchWechatArticle(url, 3, "./articles/");
console.log(`已保存: ${result.title}`);
}
请帮我抓取这个微信公众号文章并保存为 Markdown 文件:
https://mp.weixin.qq.com/s/xxxxx
⚠️ 仅用于个人学习和研究,请遵守网站服务条款 ⚠️ 频繁抓取可能被限流,建议控制请求频率 ⚠️ 抓取的内容版权归原作者所有 ⚠️ 有头模式会弹出浏览器窗口,可能干扰工作流程 ⚠️ Windows 用户首次使用需要安装 Playwright(会自动安装)