导出微信公众号文章为 Markdown/HTML 格式
Project description
wechat-export
微信文章导出工具 - 将微信公众号文章导出为 Markdown 或 HTML 格式
功能特性
- 支持导出为 Markdown 和 HTML 两种格式
- 自动下载并保存图片到本地(可选)
- 支持自定义输出目录
- 支持 HTTP 代理
- 简洁的命令行界面
- 完整的错误处理和提示
安装
# 使用 pip 安装
pip install wechat-export
# 或从源码安装
cd wechat-export
pip install -e .
使用方法
# 导出为 Markdown(默认)
wechat-export "https://mp.weixin.qq.com/s/xxx"
# 导出为 HTML
wechat-export "https://mp.weixin.qq.com/s/xxx" --format html
# 指定输出目录
wechat-export "https://mp.weixin.qq.com/s/xxx" --output ./my-articles
# 不保存图片
wechat-export "https://mp.weixin.qq.com/s/xxx" --no-images
# 使用代理
wechat-export "https://mp.weixin.qq.com/s/xxx" --proxy http://127.0.0.1:7890
# 批量导出
wechat-export "url1" "url2" "url3" --format html --output ./docs
命令行选项
URL: 微信公众号文章链接(支持多个)--format, -f: 输出格式,markdown或html(默认: markdown)--output, -o: 输出目录(默认: ./output)--title: 自定义文件名标题--save-images/--no-images: 是否保存图片到本地(默认: True)--proxy: HTTP 代理地址--embed-images: 将图片嵌入为 base64(仅 HTML 格式)
开发
# 安装开发依赖
pip install -e ".[dev]"
# 运行测试
pytest tests/
# 代码格式化
black src/
依赖
- click >= 8.0
- rich >= 13.0
- requests >= 2.28
- beautifulsoup4 >= 4.12
- markdownify >= 0.11
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wechat_export-0.1.0.tar.gz
(37.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wechat_export-0.1.0.tar.gz.
File metadata
- Download URL: wechat_export-0.1.0.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ce34da5c0416beeb051c0fd98b8fe44dc23cafd38ad83f14767e6c58583b468
|
|
| MD5 |
5fbc9898f4a41263c0f887514938f6a6
|
|
| BLAKE2b-256 |
fe0cf0df88aafc9cfcc74338b9918b1e6ca8fba29f99a240cf5f74ec8e673371
|
File details
Details for the file wechat_export-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wechat_export-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5ba7189f5467042c8fcfe7bc56b02060672ff73a17598a8ea5c840120ecaf5e
|
|
| MD5 |
acdd886b7b08a761064a9d33c813c29b
|
|
| BLAKE2b-256 |
38c3c11de88d3a4d5b5f6a21be7dde0f6e1d737622b6666c4f3f75460236b36c
|