Files
ArticleReplaceBatch/README.md
2026-03-25 15:17:18 +08:00

164 lines
3.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 文章批量处理工具
一个强大的文章批量处理工具支持文章提取、AI改写、图片处理等功能。
## 功能特性
- ✅ 多平台文章提取(头条、微信、网易等)
- ✅ AI智能改写支持Coze等AI服务
- ✅ 图片自动下载和处理
- ✅ 原创度检测
- ✅ 内容合规检测
- ✅ 多线程批量处理
- ✅ GUI和命令行双模式
## 快速开始
### 安装依赖
```bash
pip install -r requirements.txt
```
### 配置环境变量
```bash
cp .env.example .env
# 编辑 .env 文件,填写敏感信息
```
### 运行应用
**GUI模式**
```bash
python ArticleReplace.py
```
**命令行模式:**
```bash
# 处理Excel文件
python cli.py --excel 文章链接.xlsx --threads 3
# 处理单个链接
python cli.py --link https://www.toutiao.com/article/123
# 查看帮助
python cli.py --help
```
## 开发
### 代码格式化
```bash
# 格式化代码
python dev.py format
# 或直接运行
python scripts/format_code.py
```
### 运行测试
```bash
# 运行测试
python dev.py test
# 运行测试并生成覆盖率报告
python dev.py test --coverage
```
### 代码检查
```bash
# 代码检查
python dev.py lint
# 类型检查
python dev.py typecheck
```
### 打包应用
```bash
# 打包应用
python dev.py build
# 清理构建文件
python dev.py clean
```
## 项目结构
```
ArticleReplaceBatch/
├── src/ # 源代码
│ ├── ui/ # UI组件
│ │ ├── main_window.py # 主窗口
│ │ ├── main_frame.py # 主页面
│ │ ├── config_frame.py# 配置页面
│ │ └── ...
│ └── services/ # 服务层
│ ├── web_scraping.py # 网页抓取
│ ├── image_processing.py # 图片处理
│ └── ai_service.py # AI服务
├── tests/ # 测试
├── scripts/ # 开发脚本
├── config_manager.py # 配置管理
├── cli.py # 命令行接口
├── dev.py # 开发工具
└── ArticleReplace.py # GUI应用
```
## 配置说明
主要配置文件:
- `config.ini` - 应用配置
- `.env` - 环境变量(敏感信息)
- `pyproject.toml` - 项目配置
### 配置项
| 配置项 | 说明 |
|--------|------|
| Coze.workflow_id | Coze工作流ID |
| Coze.access_token | Coze访问令牌 |
| General.max_threads | 最大线程数 |
| General.articles_path | 文章保存路径 |
| General.images_path | 图片保存路径 |
## 测试
```bash
# 运行所有测试
pytest tests/ -v
# 运行特定测试
pytest tests/test_config.py -v
# 生成覆盖率报告
pytest tests/ --cov=. --cov-report=html
```
## 代码质量
项目使用以下工具保证代码质量:
- **Black** - 代码格式化
- **isort** - 导入排序
- **mypy** - 类型检查
- **flake8** - 代码检查
- **pylint** - 代码审查
## 许可证
MIT License
## 贡献
欢迎提交问题和拉取请求!
## 联系方式
如有问题请提交Issue。