大麦抢票脚本 v1.0「自动无延时抢票,支持人员、城市、日期场次、价格选择」
浏览:90 留言:1
手机扫我访问

大麦抢票脚本 v1.0「自动无延时抢票,支持人员、城市、日期场次、价格选择」

软件介绍 大麦抢票脚本 V1.0,自动无延时抢票,支持人员、城市、日期场次、价格选择。 通过selenium打 […]

大麦抢票脚本 v1.0「自动无延时抢票,支持人员、城市、日期场次、价格选择」

AI
AI文摘 此内容由AI根据文章内容自动生成
AI Summary

软件介绍

大麦抢票脚本 V1.0,自动无延时抢票,支持人员、城市、日期场次、价格选择。

通过selenium打开页面进行登录,模拟用户购票流程自动购票。

准备工作

1. 配置环境

1.1 安装python3环境

Windows

  1. 访问Python官方网站:https://www.python.org/downloads/windows/
  2. 下载最新的Python 3.9+版本的安装程序。
  3. 运行安装程序。
  4. 在安装程序中,确保勾选“Add Python XX to PATH”选项,这将自动将Python添加到系统环境变量中,方便在命令行中使用Python。
  5. 完成安装后,你可以在命令提示符或PowerShell中输入python3来启动Python解释器。

macOS

  1. 你可以使用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

1.2 安装所需的环境

在命令窗口输入以下指令

pip3 install selenium

1.3 下载google chrome浏览器

下载地址:https://www.google.cn/intl/zh-CN/chrome/?brand=YTUH&gclid=Cj0KCQjwj5mpBhDJARIsAOVjBdoV_1sBwdqKGHV3rUU1vJmNKZdy5QNzbRT8F5O0-_jq1WHXurE8a7MaAkWrEALw_wcB&gclsrc=aw.ds

2.修改配置文件

在运行程序之前,先创建config.json文件。该文件用于指定用户需要抢票的相关信息,包括演唱会的场次、观演的人员、修改城市、日期、价格等。文件结果如下图所示:

图片[1]-大麦抢票脚本 v1.0「自动无延时抢票,支持人员、城市、日期场次、价格选择」-大海资源库

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「自动无延时抢票,支持人员、城市、日期场次、价格选择」-大海资源库

接下来按照下图的标注对配置文件进行修改:

图片[3]-大麦抢票脚本 v1.0「自动无延时抢票,支持人员、城市、日期场次、价格选择」-大海资源库

最终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服务器连接地址

© 版权声明
THE END
点赞7分享
及时反馈~ 共1条

请登录后发表评论