227 lines
4.7 KiB
Markdown
227 lines
4.7 KiB
Markdown
# 抖音自动化助手
|
||
|
||
这是一个 Windows 本地工具,用来通过 ADB 控制安卓设备,自动识别直播间福袋、按配置筛选并参与。项目提供桌面 GUI、数据看板 GUI、Web GUI 和命令行入口。
|
||
|
||
> 仅供学习和个人测试使用。使用前请了解平台规则,账号风险自行承担。
|
||
|
||
## 准备环境
|
||
|
||
1. 安装 Python 3.10 或更高版本。
|
||
2. 安装 ADB / platform-tools,并确保命令行能运行 `adb devices`。
|
||
3. 手机或模拟器开启 USB 调试。
|
||
4. 首次连接设备时,在手机上允许 ADB 授权。
|
||
|
||
安装依赖:
|
||
|
||
```powershell
|
||
python -m pip install -r requirements.txt
|
||
```
|
||
|
||
如果只想先安装基础依赖,也可以运行:
|
||
|
||
```powershell
|
||
bootstrap_deps.bat
|
||
```
|
||
|
||
## 启动方式
|
||
|
||
推荐优先使用数据看板 GUI:
|
||
|
||
```powershell
|
||
python gui/gui_dashboard_app_entry.py
|
||
```
|
||
|
||
旧版桌面 GUI:
|
||
|
||
```powershell
|
||
python gui/gui_app_entry.py
|
||
```
|
||
|
||
Web GUI:
|
||
|
||
```powershell
|
||
python gui/webgui_launcher.py
|
||
```
|
||
|
||
默认访问地址:
|
||
|
||
```text
|
||
http://127.0.0.1:8000/
|
||
```
|
||
|
||
命令行运行:
|
||
|
||
```powershell
|
||
python bin/run_cli.py --needswitch --wait-minutes 5
|
||
```
|
||
|
||
## 基本使用流程
|
||
|
||
1. 启动 GUI。
|
||
2. 在顶部选择设备,或先点击刷新设备。
|
||
3. 填写筛选条件,例如最低价值、参与人数、倒计时限制。
|
||
4. 需要切换直播间时,开启“允许切换直播间”。
|
||
5. 点击“开始运行”。
|
||
6. 运行中可以点击“暂停/继续”“停止”“强制停止”。
|
||
7. 查看运行日志、行为日志、实时截图、预约队列和统计信息。
|
||
|
||
## 常用配置说明
|
||
|
||
主要配置文件:
|
||
|
||
```text
|
||
config/config.json
|
||
```
|
||
|
||
常用项:
|
||
|
||
| 配置 | 说明 |
|
||
| --- | --- |
|
||
| `min_prize_value_yuan` | 最低奖品价值,低于该值跳过 |
|
||
| `min_participants` | 最少参与人数,0 表示不限制 |
|
||
| `max_participants` | 最多参与人数,0 表示不限制 |
|
||
| `skip_if_countdown_gt_seconds` | 倒计时大于该秒数时跳过或预约 |
|
||
| `skip_if_countdown_lt_seconds` | 倒计时小于该秒数时跳过 |
|
||
| `needswitch` | 是否允许切换直播间 |
|
||
| `high_value_fudai_enabled` | 是否启用高价值福袋预约 |
|
||
| `high_value_fudai_threshold_yuan` | 高价值预约阈值 |
|
||
| `auto_join_fansclub` | 是否自动加入粉丝团,可能消耗钻石 |
|
||
| `yanghao_enabled` | 是否启用推荐页养号 |
|
||
|
||
大多数配置都可以直接在 GUI 中修改并保存。
|
||
|
||
## 日志和截图
|
||
|
||
常用路径:
|
||
|
||
```text
|
||
logs/unified.log 全量运行日志
|
||
logs/actions.log 行为日志
|
||
pic/screenshot.png 当前截图
|
||
pic/lottery/ 中奖截图
|
||
douyin/core/state/ 预约队列和运行状态
|
||
```
|
||
|
||
排查问题时,优先看:
|
||
|
||
1. GUI 的运行日志。
|
||
2. `logs/actions.log`。
|
||
3. `pic/screenshot.png` 当前页面截图。
|
||
|
||
## 预约队列
|
||
|
||
高价值预约会写入:
|
||
|
||
```text
|
||
douyin/core/state/reservations.json
|
||
```
|
||
|
||
在数据看板 GUI 中,“预约队列”页面会自动刷新。首页里的预约队列也会自动更新。
|
||
|
||
## Web GUI 端口
|
||
|
||
默认端口是 `8000`。如需修改,可以在 `config/config.json` 中设置:
|
||
|
||
```json
|
||
{
|
||
"web_gui_host": "127.0.0.1",
|
||
"web_gui_port": 9011
|
||
}
|
||
```
|
||
|
||
也可以用环境变量:
|
||
|
||
```powershell
|
||
$env:WEB_GUI_PORT = "9011"
|
||
python gui/webgui_launcher.py
|
||
```
|
||
|
||
## 常见问题
|
||
|
||
### 找不到设备
|
||
|
||
先运行:
|
||
|
||
```powershell
|
||
adb devices
|
||
```
|
||
|
||
如果显示 `unauthorized`,请在手机上重新确认 USB 调试授权。
|
||
|
||
### 点击位置不准
|
||
|
||
在 GUI 顶部调整 `Y偏移`,然后截图确认位置。
|
||
|
||
### 识别不到福袋
|
||
|
||
检查:
|
||
|
||
1. 当前截图是否清晰。
|
||
2. `assets/` 模板文件是否存在。
|
||
3. 抖音界面是否和当前模板适配。
|
||
4. 日志里是否有阶段诊断或 OCR 错误。
|
||
|
||
### 运行卡住
|
||
|
||
先点“停止”,无效时点“强制停止”。然后查看:
|
||
|
||
```text
|
||
logs/unified.log
|
||
logs/actions.log
|
||
pic/screenshot.png
|
||
```
|
||
|
||
### Web GUI 打不开
|
||
|
||
确认服务是否启动,并检查端口是否被占用。默认地址是:
|
||
|
||
```text
|
||
http://127.0.0.1:8000/
|
||
```
|
||
|
||
## 更新
|
||
|
||
如果是源码方式使用:
|
||
|
||
```powershell
|
||
git pull
|
||
python -m pip install -r requirements.txt
|
||
```
|
||
|
||
更新前建议备份:
|
||
|
||
```text
|
||
config/config.json
|
||
douyin/core/state/
|
||
```
|
||
|
||
## 测试
|
||
|
||
开发或修改代码后可以运行:
|
||
|
||
```powershell
|
||
python -m pytest
|
||
```
|
||
|
||
只检查更新相关逻辑:
|
||
|
||
```powershell
|
||
python -m pytest tests/test_auto_update.py tests/test_distribution_manifest.py
|
||
```
|
||
|
||
## 目录速查
|
||
|
||
```text
|
||
gui/ 桌面 GUI、数据看板 GUI、Web GUI 后端
|
||
webui/ Web GUI 前端
|
||
douyin/ 核心自动化逻辑
|
||
assets/ 模板图片
|
||
config/ 配置文件
|
||
logs/ 运行日志
|
||
pic/ 截图
|
||
tests/ 测试
|
||
docs/ 详细文档
|
||
```
|
||
|
||
更多内部说明可以看 `docs/` 目录。
|