wechat-article-exporter

Application

wechat-article/wechat-article-exporter

Online tool for batch downloading WeChat official account articles with export support.

Overview

A web-based tool to batch download articles from WeChat official accounts. It supports exporting reading counts and comments, and preserves original formatting in HTML. Can be deployed via Docker or Cloudflare, or used directly through an online site.

README Preview

\n  \n\n\n# wechat-article-exporter\n\n![GitHub stars]\n![GitHub forks]\n![GitHub License]\n![Package Version]\n\n\n一款在线的 **微信公众号文章批量下载** 工具,支持导出阅读量与评论数据,无需搭建任何环境,可通过 [在线网站] 使用,同时也支持 docker 私有化部署和 Cloudflare 部署。\n\n支持下载各种文件格式,其中 HTML 格式可100%还原文章排版与样式。\n\n交流群(QQ):\n- `991482155` 1群已满\n- `775909845` 2群\n- `814249342` 3群\n\n## :bell: 重要告知:项目域名调整\n项目域名调整如下:\n\n|     | 下载站                            | 文档站                        |\n|-----|--------------------------------|----------------------------|\n| 调整后 | https://down.mptext.top        | https://docs.mptext.top    |\n| 调整前 | https://exporter.wxdown.online | https://docs.wxdown.online |\n\n具体细节可以查看 [这里](https://docs.mptext.top/misc/domain.html)。\n\n\n## :books: 如何使用?\n\n该工具的使用教程已移至 [文档站点](https://docs.mptext.top)。\n\n\n## :dart: 特性\n\n- [x] 搜索公众号,支持关键字搜索\n- [x] 支持导出 html/json/excel/txt/md/docx 格式(html 格式打包了图片和样式文件,能够保证100%还原文章样式)\n- [x] 缓存文章列表数据,减少接口请求次数\n- [x] 支持文章过滤,包括作者、标题、发布时间、原创标识、所属合集等\n- [x] 支持合集下载\n- [x] 支持图片分享消息\n- [x] 支持视频分享消息\n- [x] 支持导出评论、评论回复、阅读量、转发量等数据 (需要抓包获取 credentials 信息,[查看操作步骤](https://docs.mptext.top/advanced/wxdown-service.html))\n- [x] 支持 Docker 部署\n- [x] 支持 Cloudflare 部署\n- [x] 开放 API 接口\n\n\n## :heart: 感谢\n\n- 感谢 [Deno Deploy]、[Cloudflare Workers] 提供免费托管服务\n- 感谢 [WeChat_Article] 项目提供原理思路\n\n\n## :star: 支持\n\n如果你觉得本项目帮助到了你,请给作者一个免费的 Star,感谢你的支持!\n\n\n## :bulb: 原理\n\n在公众号后台写文章时支持搜索其他公众号的文章功能,以此来实现抓取指定公众号所有文章的目的。\n\n\n## :memo: 许可\n\nMIT\n\n## :red_circle: 声明\n\n本程序承诺,不会利用您扫码登录的公众号进行任何形式的私有爬虫,也就是说不存在把你的账号作为公共账号为别人爬取文章的行为,也不存在类似账号池的东西。\n\n您的公众号只会服务于您自己的抓取文章的目的。\n\n通过本程序获取的公众号文章内容,版权归文章原作者所有,请合理使用。若发现侵权行为,请联系我们处理。\n\n\n## :chart_with_upwards_trend: Star 历史\n\n[![Star History Chart]][Star History Chart Link]\n\n\n\n\n\n[GitHub stars]: https://img.shields.io/github/stars/wechat-article/wechat-article-exporter?style=social&label=Star&style=plastic\n\n[GitHub forks]: https://img.shields.io/github/forks/wechat-article/wechat-article-exporter?style=social&label=Fork&style=plastic\n\n[GitHub License]: http

FAQ (3)

Troubleshooting
How to prevent Turndown from including CSS styles and SVG icons in exported Markdown?

This issue occurs when an unconfigured Turndown service converts a complete HTML document. Although the <head> tag is dropped, its child <style> and <title> nodes survive parsing and are output as raw text, causing CSS code to appear at the beginning. Similarly, the bottom action bar (Read/Like/Share) is converted into large inline data URI SVGs at the end. To fix this, explicitly remove these nodes before conversion or configure Turndown rules:

const turndownService = new TurndownService();
turndownService.remove(['style', 'title']);
turndownService.remove('.bottom-bar'); // Replace with the actual action bar selector
const markdown = turndownService.turndown(html);

Alternatively, update to the release that includes the unified shared/utils/markdown.ts utility, which automatically filters out these non-content elements.

GitHub Issue #138
Configuration
How can exported article filenames include the publish date?

Use the Markdown batch export option on the collection/album detail page. The exporter automatically prefixes each filename with the publish date in yyyy-MM-dd format, producing names like 2024-05-20 Article title.md. You do not need to set a separate time variable manually. The filename formatting is implemented in utils/download/album-format.ts. HTML offline export remains available as an alternative format.

GitHub Issue #166
Troubleshooting
How to fix Markdown export that starts with CSS code, includes ads or action-bar junk, and does not convert tables?

Upgrade to the fixed build containing the shared utils/markdown.ts change. The problem occurred because the exporter passed the full HTML document from renderHTMLFromCgiDataNew() to an unconfigured Turndown instance. Although <head> was dropped, <style> and <title> nodes were retained and their CSS/text was emitted at the top of the .md file; the WeChat bottom action bar was also converted, including large inline SVG data URIs.

The fix:
1. Update/redeploy the service to the version including the Markdown-export fix.
2. Convert only the article HTML, not the complete document.
3. Configure Turndown to remove style, title, script, ad, toolbar, and bottom-action nodes before conversion.
4. Enable GitHub-flavored Markdown table support, such as with turndown-plugin-gfm.
5. Re-request the export URL with format=markdown.

For a self-hosted deployment, update the code, reinstall dependencies, rebuild, restart the service, and retry the download. If you cannot upgrade immediately, use format=html as a temporary offline archive instead of the broken Markdown output.

GitHub Issue #167