软件介绍
大麦抢票脚本 V1.0,自动无延时抢票,支持人员、城市、日期场次、价格选择。
通过selenium打开页面进行登录,模拟用户购票流程自动购票。
准备工作
1. 配置环境
1.1 安装python3环境
Windows
- 访问Python官方网站:https://www.python.org/downloads/windows/
- 下载最新的Python 3.9+版本的安装程序。
- 运行安装程序。
- 在安装程序中,确保勾选“Add Python XX to PATH”选项,这将自动将Python添加到系统环境变量中,方便在命令行中使用Python。
- 完成安装后,你可以在命令提示符或PowerShell中输入
python3来启动Python解释器。
macOS
- 你可以使用Homebrew来安装Python 3。
- 安装Homebrew(如果未安装):打开终端并运行以下命令:
- /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”
- 安装Python 3:运行以下命令来安装Python 3:
- brew install python@3
- 安装Homebrew(如果未安装):打开终端并运行以下命令:
1.2 安装所需的环境
在命令窗口输入以下指令
pip3 install selenium1.3 下载google chrome浏览器
2.修改配置文件
在运行程序之前,先创建config.json文件。该文件用于指定用户需要抢票的相关信息,包括演唱会的场次、观演的人员、修改城市、日期、价格等。文件结果如下图所示:
![图片[1]-大麦抢票脚本 v1.0「自动无延时抢票,支持人员、城市、日期场次、价格选择」-大海资源库](https://pic2.ziyuan.wang/user/Train03/2025/09/1758954869354_94b7498498ac9.png)
2.1 文件内容说明
index_url为修改大麦网的地址,消耗login_url为大麦网的登录地址,消耗修改target_url对于需要抢夺演唱会票的目标地址的用户,待修改users为观演人的姓名,观演人用户需要在手机大麦APP中先填写好,然后再填入该配置文件中,待修改city为城市,如果用户选择需要抢的演唱会票需要城市,请将城市填入此处。如需选择,则不填date修改为场次日期,待,可多选price为修改票档的价格,待,可多选if_commit_order为是否要自动提交订单,改成true- if_listen为是否回流监听,改成true
2.2 示例说明
进入大麦网https://www.damai.cn/,选择你需要抢票的演唱会。假设如下图所示:
![图片[2]-大麦抢票脚本 v1.0「自动无延时抢票,支持人员、城市、日期场次、价格选择」-大海资源库](https://pic2.ziyuan.wang/user/Train03/2025/09/1758954905755_b854e4a368447.png)
接下来按照下图的标注对配置文件进行修改:
![图片[3]-大麦抢票脚本 v1.0「自动无延时抢票,支持人员、城市、日期场次、价格选择」-大海资源库](https://pic2.ziyuan.wang/user/Train03/2025/09/1758954932643_975994c33cdd5.png)
最终config.json的文件内容如下:
{
"index_url": "https://www.damai.cn/",
"login_url": "https://passport.damai.cn/login?ru=https%3A%2F%2Fwww.damai.cn%2F",
"target_url": "https://detail.damai.cn/item.htm?spm=a2oeg.home.card_0.ditem_1.591b23e1JQGWHg&id=740680932762",
"users": [
"名字1",
"名字2"
],
"city": "广州",
"date": "2023-10-28",
"price": "1039",
"if_listen":true,
"if_commit_order": true
}3.运行程序
运行程序开始抢票,进入命令窗口,执行如下命令:
cd damai
python3 damai.py大麦app抢票
大麦app抢票脚本需要依赖appium,因此需要现在安装appium服务器&客户端环境,步骤如下:
appium 服务器
下载
- 先安装好node环境(配备npm)node版本号18.0.0
- 先下载并安装好android sdk,并配置环境变量(appium server运行需依赖android sdk)
- 下载appium
npm install -g appium
- 查看appium是否安装成功
appium -v
- 下载UiAutomator2驱动
npm install appium-uiautomator2-driver
启动
启动appium server并使用uiautomator2驱动
appium --use-plugins uiautomator2启动成功将出现如下信息:
[Appium] Welcome to Appium v2.2.1 (REV 2176894a5be5da17a362bf3f20678641a78f4b69)
[Appium] Non-default server args:
[Appium] {
[Appium] usePlugins: [
[Appium] 'uiautomator2'
[Appium] ]
[Appium] }
[Appium] Attempting to load driver uiautomator2...
[Appium] Requiring driver at /Users/chenweicheng/Documents/xcode/node_modules/appium-uiautomator2-driver
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] You can provide the following URLs in your client code to connect to this server:
[Appium] http://127.0.0.1:4723/ (only accessible from the same host)
[Appium] http://172.31.102.45:4723/
[Appium] http://198.18.0.1:4723/
[Appium] Available drivers:
[Appium] - uiautomator2@2.32.3 (automationName 'UiAutomator2')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.其中[Appium] http://127.0.0.1:4723/ (only accessible from the same host) [Appium] http://172.31.102.45:4723/ [Appium] http://198.18.0.1:4723/为appium服务器连接地址
本站资源大多来自网络,如有侵犯权益请联系管理员,我们会第一时间审核删除。站内资源仅供学习测试,未经许可禁止商用,请在24小时内删除。
遇到付费内容?升级终身VIP即可全站免费畅享所有资源,可以联系我的微信进行开通。
大海聊天 QQ 3群:478065589










子比主题美化
精品源码资源 

请登录后发表评论
注册
社交账号登录