Skip to main content

DaoChu(导出)

PyPI version Python License: GPL v3

DaoChu(导出)是一个 Python 命令行工具,能将微信聊天记录导出为精美的 HTML 页面或 Markdown 文件。

通过截屏 + OCR 零侵入导出微信聊天记录。不碰任何微信数据文件。


✨ 特性

  • 📸 截图 OCR 导出 — 零数据侵入,自动截屏+中文 OCR
  • 🎨 精美 HTML 输出 — 仿微信气泡样式,带日期分组、响应式设计
  • 📝 Markdown 输出 — 纯文本,适合归档或导入笔记工具
  • 🖼️ 自动去重 — 相邻截图重叠内容智能合并

📦 安装

pip install daochu

要求 Python ≥ 3.10。


🚀 快速开始

1. 准备

  • macOS 系统(依赖 screencapture / osascript 自带)
  • 安装 Tesseract OCR:brew install tesseract
  • 中文语言包(脚本首次运行会自动下载)

2. 导出聊天记录

# 打开微信,进入目标聊天窗口,滚动到对话最顶部
# 然后运行:
python tools/screenshot_export.py -o 聊天记录.html

# 英文系统微信
python tools/screenshot_export.py -w "WeChat" -o chat.md -f md

# 限制最大截图数
python tools/screenshot_export.py -n 30

原理:AppleScript 控制微信窗口 → 逐页截屏 → Tesseract OCR 识别中文 → 智能去重 → 导出 HTML/Markdown。

3. 输出效果

  • 仿微信气泡样式 HTML(自己的消息靠右绿色,对方靠左白色)
  • 纯文本 Markdown(适合归档、笔记软件导入)
  • 自动按发送者分组,连续消息合并在同一气泡

🖥️ 命令行参考

Usage: python tools/screenshot_export.py [OPTIONS]

选项:
  -w, --window TEXT          微信窗口标题 (默认: 微信)
  -o, --output PATH          输出文件路径
  -f, --format [html|md]     输出格式 (默认: html)
  -n, --max-screenshots INT  最大截图数 (默认: 50)
  --chat-area-top-offset INT 聊天区距窗口顶部偏移 (默认: 80px)
  --dry-run                  仅截图不 OCR(调试用)

🖼️ 效果预览

HTML 输出效果:

  • 顶部:联系人名称、日期范围、消息总数
  • 每一条消息:微信风格气泡,自己的消息靠右显示为绿色
  • 日期分组:按天自动插入日期分隔线
  • 移动端适配:响应式设计,手机上也能流畅阅读

📄 License

GPL-3.0-or-later © DaoChu Contributors

Metadata

Release files for daochu 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for daochu 0.2.0
File Size Uploaded Provenance
daochu-0.2.0.tar.gz 21.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for daochu 0.2.0
File Interpreter ABI Platform
daochu-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.7 kB

Release files / daochu-0.2.0.tar.gz

Download URL daochu-0.2.0.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7362aff7ded7691c93fd8c90161b9ff0670ab6ad3551d1984f91f7806473f08a
BLAKE2b-256 checksum
How to use checksums
d0212f862abfde748c56644ccc3076fcffbe1690df99cb855b623038e339f1d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / daochu-0.2.0-py3-none-any.whl

Download URL daochu-0.2.0-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1baaff18f2efe2a2b27f3358c1356aeb738acb246a9c936b6ebfced90d015cd9
BLAKE2b-256 checksum
How to use checksums
d27dce83423a023ed139bdca3d816822acf20a50772189021d9f12ce17e5d790
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for daochu 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page