Install
openclaw skills install @limingfa/wechat-mp-reader-fzx抓取微信公众号文章并转换为 Markdown 格式。支持提取标题、作者、发布时间、封面图、正文内容(含图片、视频链接)。 当用户提到以下场景时触发: - 读取/抓取/下载微信公众号文章 - 将公众号文章转为 Markdown - 提取 mp.weixin.qq.com 链接内容 - 保存公众号文章到本地 - 微信文章备份、存档 关键词:微信公众号、公众号文章、mp.weixin.qq.com、微信文章抓取、微信文章转 Markdown
openclaw skills install @limingfa/wechat-mp-reader-fzx抓取微信公众号文章(mp.weixin.qq.com 链接),提取完整内容并转换为 Markdown 格式保存到本地。
python scripts/fetch_wechat_article.py <文章链接> [选项]
参数:
url — 微信公众号文章链接(必需)-o, --output — 输出目录(默认:当前目录)--images — 下载图片到本地(开发中)--json — 以 JSON 格式输出元数据示例:
# 基本用法
python scripts/fetch_wechat_article.py "https://mp.weixin.qq.com/s/xxxxx"
# 指定输出目录
python scripts/fetch_wechat_article.py "https://mp.weixin.qq.com/s/xxxxx" -o ./articles
# 只输出 JSON 元数据
python scripts/fetch_wechat_article.py "https://mp.weixin.qq.com/s/xxxxx" --json
from scripts.fetch_wechat_article import fetch_article
result = fetch_article(
url="https://mp.weixin.qq.com/s/xxxxx",
output_dir="./articles"
)
print(result['title']) # 文章标题
print(result['author']) # 公众号名称
print(result['content']) # Markdown 正文
print(result['filepath']) # 保存的文件路径
生成的 Markdown 文件结构:
# 文章标题
**公众号**: 公众号名称
**发布时间**: 2024-01-01
**封面**: 
**原文链接**: https://mp.weixin.qq.com/s/xxxxx
---
正文内容...

[视频](视频链接)
requests 库(用于 HTTP 请求)安装依赖:
pip install requests
mp.weixin.qq.com| 问题 | 可能原因 | 解决方案 |
|---|---|---|
| 无法提取正文 | 页面结构变化 | 检查微信是否更新了页面结构 |
| 返回 403 | 被反爬拦截 | 稍后再试,或更换 IP |
| 标题为空 | 文章被删除/受限 | 确认链接可在浏览器正常打开 |
| 图片不显示 | 微信 CDN 链接过期 | 使用 --images 下载到本地 |