Metadata-Version: 2.4
Name: daochu
Version: 0.1.0
Summary: 导出微信聊天记录为 HTML / Markdown — Export WeChat conversations to HTML or Markdown
Author-email: DaoChu Contributors <daochu@example.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/daochu/daochu
Project-URL: Repository, https://github.com/daochu/daochu
Keywords: wechat,export,chat,html,markdown,backup
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: End Users/Desktop
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0
Requires-Dist: jinja2>=3.0
Provides-Extra: dev
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Dynamic: license-file

# DaoChu（导出）

[![PyPI version](https://img.shields.io/pypi/v/daochu.svg)](https://pypi.org/project/daochu/)
[![Python](https://img.shields.io/pypi/pyversions/daochu.svg)](https://pypi.org/project/daochu/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

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

> 支持解密后的微信 SQLite 数据库、CSV 导出、JSON 导出三种数据源。

---

## ✨ 特性

- 🎨 **精美 HTML 输出** — 仿微信气泡样式，带日期分组、响应式设计
- 📝 **Markdown 输出** — 纯文本，适合归档或导入笔记工具
- 🔍 **自动联系人发现** — `list-contacts` 命令快速查看所有联系人
- 🧠 **智能解析** — 自动识别文件类型（.db / .csv / .json）
- 🖼️ **媒体标注** — 图片、语音、视频、链接等自动标注为可读文本

---

## 📦 安装

```bash
pip install daochu
```

要求 Python ≥ 3.10。

---

## 🚀 快速开始

### 1. 列出联系人

```bash
daochu list-contacts /path/to/decrypted/MSG.db
```

### 2. 导出聊天记录

```bash
# 导出为 HTML（默认）
daochu export MSG.db "wxid_abc123"

# 导出为 Markdown
daochu export MSG.db "wxid_abc123" -f md

# 指定输出路径
daochu export MSG.db "wxid_abc123" -o ~/Desktop/chat.html

# 自定义自己的显示名
daochu export MSG.db "wxid_abc123" --me "小明"
```

---

## 📂 数据源说明

| 类型 | 说明 |
|------|------|
| **SQLite (.db)** | 解密后的微信 Msg 数据库，最常见的方式 |
| **CSV (.csv)** | 从第三方工具导出的 CSV，需含 timestamp/sender/content 列 |
| **JSON (.json)** | 消息对象数组，格式 `[{timestamp, sender, content}]` |

> **如何获取解密数据库？** 微信数据库默认加密存储在 `Documents/WeChat Files/<wxid>/Msg/` 下。可使用开源工具解密后配合 DaoChu 使用。

---

## 🖥️ 命令行参考

```
Usage: daochu [OPTIONS] COMMAND [ARGS]...

Commands:
  export          导出与某个联系人的全部聊天记录
  list-contacts   列出数据库中的所有联系人

export 选项:
  -o, --output PATH        输出目录或文件路径
  -f, --format [html|md]   输出格式
  --me TEXT                自己的显示名称
  --source-type [auto|db|csv|json]
  --table TEXT             数据库表名
  --encoding TEXT          文件编码
```

---

## 🐍 Python API

```python
from daochu.parser import parse_db
from daochu.exporter import export

conv = parse_db("MSG0.db", "wxid_abc123", my_name="我")
export(conv, "output.html", fmt="html")
```

---

## 🖼️ 效果预览

HTML 输出效果：

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

---

## 📄 License

MIT © DaoChu Contributors
