Coder Social home page Coder Social logo

ronething / xiudong-selenium Goto Github PK

View Code? Open in Web Editor NEW
191.0 3.0 32.0 355 KB

Implement showstart order service based on python with selenium and flask(基于 selenium 和 flask 实现的秀动辅助)

Home Page: https://blog.csdn.net/ronething/article/details/124222763

License: GNU General Public License v3.0

Python 100.00%
python selenium showstart xiudong

xiudong-selenium's Introduction

xiudong-selenium

此版本为 selenium 模拟浏览器操作。

试试能不能抢到椅子乐团演出票

github repo: https://github.com/ronething/xiudong-selenium 防止一部分爬虫乱转载。

usage

chromedriver 程序需要下载一下

https://chromedriver.chromium.org/downloads

git clone https://github.com/ronething/xiudong-selenium.git
pip3 install -r req.txt
python3 main.py

提供了两个 api

  • 一个是跳转到登录页面,请自行登录 /login
  • 一个是通用购买演出票 api,请自行传入对应参数, 支持定时功能 /buy?event=xxx&ticketId=xxx&cron_time=xxx
  • 支持自动选择观演人

need_select 如果不传,则不会选择观演人,如果传了,则会获取 select_num 的值进行观演人数量的选择, 具体逻辑参见代码

$ curl "http://127.0.0.1:9997/buy?event=169893&ticketId=xxx&need_select=True&ticketNum=1&select_num=1"
  • 现可通过 xiudong-go 进行 ticketId 的获取
  • 如果多次刷新 login 且登录页面没有进行登录,可能会存在线程阻塞问题,因为 max_workers 设置了 10 个, 暂时可以通过关闭窗口解决
  • 如果确认订单页面显示已售罄,需要不断刷新直到出现立即支付,这一点在捡漏的时候很有用
  • 只是给大家提供点思路,其他请自行阅读代码,祝大家好运
  • 注意: 有问题请先看 issue, 没有则新开 issue 提问即可

成功截图

昨晚抢到了。不错。

免责声明

本仓库发布的 xiudong-selenium 项目中涉及的任何脚本,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。

本项目内所有资源文件,禁止任何公众号、自媒体进行任何形式的转载、发布。

本人对任何脚本问题概不负责,包括但不限于由任何脚本错误导致的任何损失或损害.

间接使用脚本的任何用户,包括但不限于建立VPS或在某些行为违反国家/地区法律或相关法规的情况下进行传播, 本人 对于由此引起的任何隐私泄漏或其他后果概不负责。

请勿将 xiudong-selenium 项目的任何内容用于商业或非法目的,否则后果自负。

如果任何单位或个人认为该项目的脚本可能涉嫌侵犯其权利,则应及时通知并提供身份证明,所有权证明,我们将在收到认证文件后删除相关脚本。

以任何方式查看此项目的人或直接或间接使用 xiudong-selenium 项目的任何脚本的使用者都应仔细阅读此声明。本人 保留随时更改或补充此免责声明的权利。 一旦使用并复制了任何相关脚本或 xiudong-selenium 项目,则视为您已接受此免责声明。

您必须在下载后的24小时内从计算机或手机中完全删除以上内容。

本项目遵循 GPL-3.0 License 协议,如果本特别声明与 GPL-3.0 License 协议有冲突之处,以本特别声明为准。

您使用或者复制了本仓库且本人制作的任何代码或项目,则视为已接受此声明,请仔细阅读 您在本声明未发出之时点使用或者复制了本仓库且本人制作的任何代码或项目且此时还在使用,则视为已接受此声明,请仔细阅读

2023/05/18 补充:理论上目前使用此项目抢到票的概率会比较低,仅作为学习交流使用,谢谢。

change log

  • 2022/06/18 支持自动选择观演人

Star History

Star History Chart

acknowledgement

xiudong-selenium's People

Contributors

dependabot[bot] avatar oneeeeeeeeeee avatar ronething avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

xiudong-selenium's Issues

如何使用

ticketId 只能在点击立即购票后才能获取吗?可以出一下使用流程吗?没太弄明白,在浏览器输入 /buy 后只有在有票的情况下才能进入吗?

Detected factory 'create_app' in module

FLASK_APP = main.py
FLASK_ENV = development
FLASK_DEBUG = 0
In folder H:/秀动/xiudong-selenium-main
G:\Anaconda\python.exe -m flask run

  • Serving Flask app 'main.py' (lazy loading)
  • Environment: development
  • Debug mode: off
    Usage: main.py run [OPTIONS]

Error: Detected factory 'create_app' in module 'xiudong-selenium-main.main', but could not call it without arguments. Use "FLASK_APP='xiudong-selenium-main.main:create_app(args)'" to specify arguments.

大佬,使用新版本的时候,遇到这个问题,一运行main.py就报错。在网上也没有找到解决办法,能麻烦您帮忙看看是怎么回事吗?

data:;

部署项目的时候,运行之后只出现了这个页面,想问下大佬怎么进入login的页面
image

顺便说一下大佬你的blog打不开,想了解一下项目详细一点的运行步骤,刚接触不太懂

请问怎么多开?

看您在 #2 中有推荐多开,但是不是很明白怎么操作。是在自动打开的浏览器外,再另外开浏览器吗。但是它好像无法接入程序

linux环境如何实现登录?

你好我本地windows正常运行,并且尝试了购票也成功了。但是我现在想部署到我的linux服务器,现在是成功启动了。我想问的是如何实现登录呢,我的linux是没有图形界面的,是必须需要装图形界面才能实现登录功能吗?就是登录接口是否能以参数的形式调用?

抢票记录

有抢到票的小伙伴可以考虑发一下记录。记得打码个人信息(手机号等)。

Main 报错,

C:\Users\Ronaldo\PycharmProjects\xiudong-selenium\venv\Scripts\python.exe C:/Users/Ronaldo/PycharmProjects/xiudong-selenium/main.py
Traceback (most recent call last):
File "C:\Users\Ronaldo\PycharmProjects\xiudong-selenium\venv\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\Ronaldo\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 969, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Ronaldo\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Ronaldo\PycharmProjects\xiudong-selenium\main.py", line 8, in
driver = load_driver()
File "C:\Users\Ronaldo\PycharmProjects\xiudong-selenium\driver.py", line 31, in load_driver
driver = webdriver.Chrome(executable_path=executable_path, options=options)
File "C:\Users\Ronaldo\PycharmProjects\xiudong-selenium\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in init
super(WebDriver, self).init(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\Ronaldo\PycharmProjects\xiudong-selenium\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 89, in init
self.service.start()
File "C:\Users\Ronaldo\PycharmProjects\xiudong-selenium\venv\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

Process finished with exit code 1

以下能正常执行
from selenium import webdriver
driver = webdriver.Chrome()
url = "http://www.baidu.com"
driver.get(url)

同账号,挂两个不同的票价进行抢购

目前只能尝试使用两个账号去抢,好像网页只能登一个账号,同手机号再登录另外一个就会被踢出。 请问怎么能实现一个账号),同时抢两个价位的票呢?(观察到输入ORDER URL的时候都是只有第一个窗口在运行刷新购票,输入第二个ORDER URL 的时候也是会跳转到第一个窗口进行抢票)

issues

有点不会用 可以加个联系方式 教一下吗

不支持自动选中观演人

夏企6.10广州场的时候,需要绑定观演人才能抢票。
每次刷到票之后,没有办法直接生成订单,反而一直刷新,同时提示”请选择观演人“,但是因为一直刷新又无法选择。

支付时遇到的问题

image
image
想请教一下,这里的异常是什么原因呢?为什么会有个error: has no permission的报错,遇到这样的情况应该不断让脚本继续刷吗? @ronething

不进行按钮点击

进入到抢票页面了,但是不会产生点击行为,定时也用不了。但是py里没有报错,大佬能帮忙看看是为什么么
image

问题描述

使用\buy接口时,浏览器“演出订单确认界面”报错‘system error’

前面的流程我都走过了,在试用buy接口时,发生问题
登陆后,比如执行http://127.0.0.1:9997/buy?event=event=177982&ticketId=ticketId=4d0555de9165462515e6376ef0162e0d&cron_time=2022%2007%2009%2023%2034%2000
时,浏览器会自动跳转到网址https://wap.showstart.com/pages/order/activity/confirm/confirm?sequence=event%3D177982&ticketId=ticketId%3D4d0555de9165462515e6376ef0162e0d&ticketNum=1&ioswx=1&terminal=app&from=singlemessag=e&isappinstalled=0
同时浏览器会出现报错,浏览器界面是空白的如下图所示,而脚本这边没有错误信息输出,看起来是正常的,执行窗口输出的也是buy OK!

image
image

开抢时瞬间会提示操作太频繁了

场景:
热门城市的热门演出,(杭州刺猬),开售时瞬间会提示操作太频繁了 440代码
捡漏时候偶尔已经正准备生成订单了,但是刷的一下也会被秒完并提示操作太频繁 440代码
菜鸡想到的解决方案:
在刷新的时候设置了sleep(float(random.random()/5)),测试了一下440出现的原因大概率是票售罄或者未开票。

想请教下大佬:
1.有没有什么方式可以提高一下抢票成功率的方式,少避免出现点击频繁的方法,比较热门的演出热门城市的话成功不高。
2.若开售时间为12:00时候,是设置成12:00还是12:03,看到有提前3s抢票机制
3.若出现440操作过快时候应该继续让它转圈圈还是自己手动刷新页面
f858469e01b537b99f0182223a4b455

问题描述

TickId请问如何获取

Hi, ronething
我想抢康姆士成都场的票,目前没有开放预售,请问是要预售后才能获取ticketid吗?
还有支付方式如何解决?

另外,非常感谢您的项目!
如果需要,提供下支持的渠道,我的个人邮箱是[email protected](规避法律风险,可以私发我)

有个新问题,关于如何设置抢票的数量

我今天尝试抢票,我想抢两张的,但是通过BUY接口进行的话,http://127.0.0.1:9997/buy?event=XX&ticketId=XXX&cron_time=XXX,默认页面都是一张。不知道如何修改票数比较好,我是通过页面链接修改的,这在正常抢票管用。
但是捡漏的时候设置不了了,第一轮没抢到后,我重新设置了5分钟后的时间,它还是一进去就疯狂刷新点击,来不及修改。
虽然这次没抢成功,不过应该是运气问题吧,票确实挺少的。

[feat] 需要选择观演人的场次支持

1、手动标识是否需要选择观演人,默认不选择
2、如果需要选择观演人,可以指定需要选择的人数,默认选择一个

使用方法请看 readme 或者直接看代码

目前暂时未打算实现,未通用的版本可考虑参考 #19

期待一个师傅提交 pr

[chore] 基础使用问题

python不太了解,我现在能唤起chrome,但是出来之后,不跳转到登录页面,应该怎么弄呀?希望大佬能解答一下,我很菜,如果不嫌弃就我就好。Orz...
TWXRT89I_V%N}{LQF5D8E1V

能自动选择观演人吗?

热门的票都要先绑定观演人,秀动不会自动勾选,需要手动选择。我好像没看到这个逻辑

Could not call it without arguments?

您好,我想请教一下,以下报错可能是什么原因导致的?我看到有另外一个小伙伴也遇到了同样的问题。

PyDev console: starting.
Traceback (most recent call last):
  File "C:\Users\17258\Desktop\xiudong-selenium-main\venv\lib\site-packages\flask\cli.py", line 77, in find_best_app
    app = app_factory()
TypeError: create_app() missing 2 required positional arguments: 'driver' and 'pool'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "<input>", line 6, in <module>
  File "C:\Users\17258\Desktop\xiudong-selenium-main\venv\lib\site-packages\flask\cli.py", line 389, in load_app
    app = locate_app(import_name, name)
  File "C:\Users\17258\Desktop\xiudong-selenium-main\venv\lib\site-packages\flask\cli.py", line 251, `in` locate_app
    return find_best_app(module)
  File "C:\Users\17258\Desktop\xiudong-selenium-main\venv\lib\site-packages\flask\cli.py", line 85, in find_best_app
    raise NoAppException(
flask.cli.NoAppException: Detected factory 'create_app' in module 'xiudong-selenium-main.app', but could not call it without arguments. Use "FLASK_APP='xiudong-selenium-main.app:create_app(args)'" to specify arguments.

貌似现在很难抢了

修改了部分代码 今天尝试着抢了好几场都没有抢到 不知道是票太少还是怎么回事😅

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.