Back to rankings

MakiNaruto/Automatic_ticket_purchase

Python

大麦网抢票脚本

seleniumbeautifulsoup4requestspython3
Star Growth
Stars
5.6k
Forks
935
Weekly Growth
Issues
12
2k4k
May 2019Sep 2021Feb 2024Jul 2026
ArtifactsPyPIpip install automatic_ticket_purchase
README

已停止维护

大部分购买方式已迁移至手机端,需配合抓包处理。暂无更新计划。

大麦抢票脚本 V2.1

更新

  • 增加选座购买,暂时只支持抢购指定价格下的座位,且暂不支持连坐购买。

大麦抢票脚本 V2.0

在学习到接口相关知识后,决定改造之前的脚本。

功能介绍

之前的版本通过按钮操作,还要等待页面元素加载,效率低下。 此版本仅需登录时用到页面,通过selenium打开页面进行登录。其余操作均通过requests进行请求。

ps: 暂不支持选座购买。

其流程图如下:

准备工作

1. 配置环境

1.1 安装所需要的环境

pip install -r requirements.txt

1.2 需要下载与系统安装对应的ChromeDriver驱动并配置(也可以改用其他浏览器驱动),

下载地址: http://chromedriver.storage.googleapis.com/index.html

1.3 配置驱动路径,默认在项目根目录下。

例如:windows系统下,则重命名下载的chromedriver,将其重命名为chromedriver_windows

def account_login():
    if platform.system().lower() == 'linux':
        chromedriver = os.path.join(os.getcwd(), 'chromedriver_linux')
    elif platform.system().lower() == 'windows':
        chromedriver = os.path.join(os.getcwd(), 'chromedriver_windows')
    else:
        chromedriver = os.path.join(os.getcwd(), 'chromedriver_mac')

2. 运行

2.1 若采取账号方式,修改代码中下面的信息,进行抢票。

item_id根据地区来确定,每一个城市对应不同的item_id。选择相应地区后将箭头指向的item_id填写到函数内。

def __init__(self):
    ...
    # 若选择账号登录方式,则需要填写
    self.login_id: str = 'account'          # 大麦网登录账户名
    self.login_password: str = 'password'   # 大麦网登录密码
    # 以下为抢票必须的参数
    self.item_id: int = 610820299671        # 商品id
    self.viewer: list = ['viewer1']         # 在大麦网已填写的观影人
    self.buy_nums: int = 1                  # 购买影票数量, 需与观影人数量一致
    self.ticket_price: int = 180            # 购买指定票价

image

2.2 运行

初次登陆没有cookies,默认登录方式为账号密码登录方式,可改成其他方式进行登录,如扫码或短信登录。

# 默认登录方式
python Automatic_ticket_purchase.py
# 指定其他方式登录
python Automatic_ticket_purchase.py --mode qr

免责声明:详见MIT License,此仓库仅用于个人参考学习,但如他人用本仓库代码用于商业用途(鄙视黄牛),侵犯到大麦网利益等,本人不承担任何责任。

Related repositories
SeleniumHQ/selenium

A browser automation framework and ecosystem.

JavaMavenApache License 2.0seleniumwebdriver
selenium.dev
34.3k8.7k
feder-cr/Jobs_Applier_AI_Agent_AIHawk

AIHawk aims to easy job hunt process by automating the job application process. Utilizing artificial intelligence, it enables users to apply for multiple jobs in a tailored way.

PythonPyPIGNU Affero General Public License v3.0automationbot
30k4.6k
CloakHQ/CloakBrowser

Stealth Chromium that passes every bot detection test. Drop-in Playwright replacement with source-level fingerprint patches. 30/30 tests passed.

PythonPyPIMIT Licenseanti-detectbot-detection
cloakbrowser.dev
28.9k2.3k
feder-cr/Jobs_Applier_AI_Agent

Auto_Jobs_Applier_AI_Agent aims to easy job hunt process by automating the job application process. Utilizing artificial intelligence, it enables users to apply for multiple jobs in an automated and personalized way.

PythonPyPIautomationbot
24.5k3.6k
browserbase/stagehand

The SDK For Browser Agents

TypeScriptnpmMIT Licenseagentsai
stagehand.dev
23.6k1.6k
Skyvern-AI/skyvern

Automate browser based workflows with AI

PythonPyPIGNU Affero General Public License v3.0apiautomation
skyvern.com
22.5k2.1k
gildas-lormeau/SingleFile

Web Extension for saving a faithful copy of a complete web page in a single HTML file

JavaScriptnpmGNU Affero General Public License v3.0browserarchive
getsinglefile.com
21.9k1.4k
InstaPy/InstaPy

📷 Instagram Bot - Tool for automated Instagram interactions

PythonPyPIGNU General Public License v3.0instagramclarifai
18k3.9k
Kr1s77/awesome-python-login-model

😮python模拟登陆一些大型网站,还有一些简单的爬虫,希望对你们有所帮助❤️,如果喜欢记得给个star哦🌟

PythonPyPIOtherpythonspiders
16.2k3.2k
budtmo/docker-android

Android in docker solution with noVNC supported and video recording

PythonPyPIOtherdocker-androidandroid
15.6k1.7k
shengqiangzhang/examples-of-web-crawlers

一些非常有趣的python爬虫例子,对新手比较友好,主要爬取淘宝、天猫、微信、微信读书、豆瓣、QQ等网站。(Some interesting examples of python crawlers that are friendly to beginners. )

HTMLMIT Licensecrawlerspider
14.7k3.8k
schickling/chromeless

🖥 Chrome automation made simple. Runs locally or headless on AWS Lambda.

TypeScriptnpmMIT Licenseserverlessintegration-testing
chromeless.netlify.com
13.2k569