Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

wechat-article-to-markdown

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

wechat-article-to-markdown

微信公众号文章抓取 & Markdown 转换工具 (cheerio + axios + turndown)

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

wechat-article-to-markdown

微信公众号文章抓取 & Markdown 转换工具。

使用 cheerio + axios + turndown 将微信公众号文章转换为干净的 Markdown 文件,图片自动下载到本地。

🔗 同系列 AI 工具: bilibili-cli — B站命令行工具,支持视频信息、字幕、搜索、互动,同样为 AI Agent 设计。

功能

  • 📄 文章抓取 — 输入 URL,输出结构化 Markdown
  • 🖼 图片本地化 — 微信 CDN 图片并发下载到本地,Markdown 引用相对路径
  • 💻 代码块提取 — 正确处理微信 code-snippet 代码块,保留语言标识
  • 📅 元数据保留 — 标题、公众号名称、发布时间、原文链接
  • 🧹 格式清理 — 去除  、多余空行、行尾空格

安装

# 全局安装
npm install -g wechat-article-to-markdown

# 或使用 npx 直接运行(无需安装)
npx wechat-article-to-markdown "https://mp.weixin.qq.com/s/xxxxxxxx"

快速开始

# 全局安装后
wechat-to-md "https://mp.weixin.qq.com/s/xxxxxxxx"

# 或从源码运行
git clone git@github.com:jackwener/wechat-article-to-markdown.git
cd wechat-article-to-markdown
npm install
node index.js "https://mp.weixin.qq.com/s/xxxxxxxx"

输出目录结构:

output/
└── 文章标题/
    ├── 文章标题.md
    └── images/
        ├── img_001.png
        ├── img_002.png
        └── ...

输出示例

# 文章标题

> 公众号: xxx
> 发布时间: 2026-02-28 11:42
> 原文链接: https://mp.weixin.qq.com/s/...

---

正文内容...

![](images/img_001.png)

技术方案

功能方案
HTTP 请求axios + 浏览器 UA 伪装
HTML 解析cheerio (jQuery-like selector)
HTML → Markdownturndown
图片下载axios arraybuffer + 并发控制

微信文章 HTML 关键结构

元素选择器
标题#activity-name
公众号名#js_name
发布时间JS 变量 create_time
正文#js_content
图片img[data-src] (懒加载)
代码块.code-snippet__fix

限制

  • 微信反爬机制可能导致验证码拦截(频繁请求时)
  • 部分代码块用图片/SVG 渲染,无法提取文本
  • 仅支持公开可访问的文章 URL

AI 助手集成

Claude Code / Antigravity

# 克隆到项目的 skills 目录
mkdir -p .agents/skills
git clone git@github.com:jackwener/wechat-article-to-markdown.git .agents/skills/wechat-article-to-markdown

# 或者只复制 SKILL.md
curl -o .agents/skills/wechat-article-to-markdown/SKILL.md \
  https://raw.githubusercontent.com/jackwener/wechat-article-to-markdown/main/SKILL.md

添加后,支持 .agents/skills/ 的 AI Agent 会自动发现并使用本工具。

OpenClaw / ClawHub

官方支持 OpenClawClawHub 生态。通过 ClawHub 安装:

clawhub install wechat-article-to-markdown

安装后即可在 OpenClaw 中直接使用。SKILL.md 同时兼容 Claude Code 和 OpenClaw 两个生态。

License

MIT

Keywords

wechat

FAQs

Package last updated on 04 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts