Files
damai/README.md
zhaojie b711b98dc8 v1.0: 重写核心代码,清理空壳脚本
- 重写 ticket_script.py: 状态机、完整的选票/下单流程、反检测
- 重写 scripts/: 验证码处理、定时调度、NTP校时、多账户管理
- 删除空壳 appium_simulator.py
- 清理配置文件中的硬编码密码
- 重写 README,去除虚假宣传
2026-04-01 15:24:34 +08:00

72 lines
2.4 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.
# 大麦网抢票工具
基于 Selenium 的大麦网自动抢票脚本,支持定时开抢、多账户并发、验证码处理。
## 功能
- **自动抢票**:自动选日期→场次→票价→提交订单
- **定时开抢**NTP 时间校准,精确到毫秒级触发
- **多账户**:支持多账号并发抢票
- **验证码**:自动检测和处理滑块验证码
- **Cookie 持久化**:扫码登录后自动保存/加载 Cookie
- **反检测**:隐藏 webdriver 痕迹,移动端模拟
## 快速开始
```bash
# 1. 安装依赖
pip install selenium ntplib Pillow
# 2. 下载 chromedriver匹配你的 Chrome 版本)
# https://googlechromelabs.github.io/chrome-for-testing/
# 3. 编辑配置
cp config/config.json config/my_config.json
# 修改 target_url、date、sess、price 等参数
# 4. 运行(首次需要扫码登录)
python ticket_script.py config/my_config.json
```
## 配置说明
```json
{
"date": [1, 2], // 日期优先级序号 (1-based)
"sess": [1, 2], // 场次优先级序号 (1-based)
"price": [1, 2, 3], // 票价优先级序号 (1-based)
"ticket_num": 2, // 购买张数
"viewer_person": [1, 2], // 观影人序号 (1-based)
"nick_name": "", // 用户昵称
"driver_path": "/usr/local/bin/chromedriver",
"damai_url": "https://www.damai.cn/",
"target_url": "https://m.damai.cn/damai/detail/item.html?itemId=xxx",
"max_retries": 180, // 最大重试次数
"retry_delay": 0.3 // 重试间隔(秒)
}
```
## 项目结构
```
├── ticket_script.py # 核心抢票逻辑
├── scripts/
│ ├── main.py # 主入口(单/多账户)
│ ├── selenium_driver.py # 浏览器驱动工厂
│ ├── captcha_solver.py # 验证码检测与处理
│ ├── scheduler.py # 定时调度与 NTP 校时
│ ├── multi_account_manager.py # 多账户管理
│ └── mock_dependency_manager.py # GUI 依赖模拟
├── GUI.py # Tkinter 配置界面
└── config/
├── config.json # 默认配置
└── demo_config.json # 示例配置
```
## 说明
- 首次运行会打开浏览器,需要手动扫码登录
- 登录成功后 Cookie 会保存到 `cookies.pkl`,下次自动加载
- 支持通过 GUI 界面编辑配置(`python GUI.py`
- 仅限个人学习研究使用