makinaruto / automatic_ticket_purchase Goto Github PK
View Code? Open in Web Editor NEW大麦网抢票脚本
License: MIT License
大麦网抢票脚本
License: MIT License
你好,想了解一下这个签名的生成的依据是什么呢,为什么可以通过网站的验证
如题,
今天用改程序搭配firefox浏览器抢大麦的票的时候
提示购票数添加失败,日期选择失败
因为我的实验页面是场次和票价双选,所以xpath和代码中提供的有出入。更改了对应的xpath之后,发现通过xpath做find是不会报错的。但对find到的东西做click()时会进入到exception中。想问一下有没有好的解决办法啊,迷茫 ToT
您好,请问出现这样的错误是什么原因?
TypeError: init() got an unexpected keyword argument 'options'
elif ticket_sku_status == '立即购买': buy_serial_number = '{}_{}_{}'.format(self.item_id, self.buy_nums, sku_id) submit_order_info = self.step2_click_buy_now(ex_params, buy_serial_number) break
elif ticket_sku_status == '立即预订': buy_serial_number = '{}_{}_{}'.format(self.item_id, self.buy_nums, sku_id) submit_order_info = self.step2_click_buy_now(ex_params, buy_serial_number) break
若进入死循环 修改为立即预订 即可进行购买
问题描述:
buy_status = json.loads(response.text) 请求下单接口的时候返回:(非热门票测试)
{'ret': ['FAIL_SYS_USER_VALIDATE', 'RGV587_ERROR::SM::哎哟喂,被挤爆啦,请稍后重试'], 'data': {'url': 'https://buy.damai.cn:443//multi/trans/createOrder/_____tmd_____/punish?x5secdata=xb56c99d1179f379b61ba303bb8ec2a5d51657274589a-717315356a1926515014aaaac2dj176370006a__bx__buy.damai.cn%3A443%2Fmulti%2Ftrans%2FcreateOrder&x5step=2'}}
简单的尝试:
1.过了一个时间段,删除cookie重试了大概2~3次,返回失败
2.切换一个账号,返回失败
3.尝试提交订单时使用 移动端的ua ,返回失败
复现:
貌似在pc端,提交下单按钮的时候会出现一个滑动验证框(chromedriver 必现,chrome滑动验证过后下次不再出现)
想请教大佬这样的情况该怎么避免呢,因为感觉是直接请求购票接口,貌似没有使用类似selenuim的点击不会提示操作频繁。亦或是我这个ip被关进小黑屋(之前有selenium抢告五人的经历)
还没开始buybtn的时候没法添加多个票吗??? 终端一直返回:购票数添加失败
即将开抢 这个一般抢票之前多久出来??刷新页面不受影响吗???
明天五月天突然买票..测试时间太短了...
请问我这是哪里出了问题 谷歌我清过了
如题,bx-umidtoken貌似是固定不变的,但是bx-ua不知道是怎么算出来的,求大佬帮看
Message: no such element: Unable to locate element: {"method":"css selector","selector":".perform"}
(Session info: chrome=75.0.3770.100)
一直报这个错,请问怎么解决,百度无果
Automatic_ticket_purchase/Automatic_ticket_purchase.py
Lines 262 to 263 in 69f5613
如果是不需要选择观演人的场次,会有异常发生
类似 'Nonetype' object has no attribute 'group'
之类
这里应该需要先判断 re.search('dmViewerPC_[0-9]*', dm_viewer_pc)
是否为 None,有时间我修复一下提个 pr
请问如果有日期、场次等信息是包含在哪个参数里面
身份证信息在提交订单的时候显示null
requests.exceptions.SSLError: httpconnectionpool (host='detail.damai.cn', port=443): Max retries exceeded with url: /subpage? damai&scenario=itemsku&dataType=&dataId=&privilegeActId=(导致的SSLError(SSLEOFError(8, 'EOF发生在违反协议(_ssl.c:1123)'))
谷歌内核下载根目录还是跑不起来,求指点!!!!!!!!!!!!!!
每次自动进入购买界面的时候会显示“输入的联系人含特殊字符或长度不符,请修改后重新提交”以及“您输入的手机号码不符合规范,请重新输入”?我检查了一下,填写的是对的,只有手动刷新后重新填写才能手动继续
可以跑通而且蛮快的!非常感谢~
想问一下有没有选择演出时间和票价的模块可以补充呀
我也在参考原代码自己添加这部分,但之前没接触过网页相关所以不知道能不能行,加油
再次感谢!!
第一次接触selenium 不过原理蛮简单 摸索一下就能加上选择票档的功能
具体代码
self.driver.find_elements_by_xpath('//html//body//div[@class = "perform__order__select"]//div[2]//div//div[X]')[0].click()
X代表的就是第几个票档 加在while self.driver.title.find('确认订单') == -1:
这句下面就可以了
感谢作者嗷
关于选座大家有什么方法吗?
整个可选区域划分成几大块并给定像素值,鼠标位置信息在另一个div,class="hover-info",只有将鼠标放在可选位置的时候,该span才会显示有element的内容。
所以要根据什么去定位呢,应该没办法直接用几排几座,可以用每个座位在块中的位置吗?我目前没有什么思路诶,也没有查到这方面的教程。
请大家帮忙或者指路~
编译器报出问题如下:
Traceback (most recent call last):
File "C:/Users/ATiS/Downloads/Automatic_ticket_purchase-master/Automatic_ticket_purchase-master/Automatic_ticket_purchase.py", line 315, in
a.run()
File "C:/Users/ATiS/Downloads/Automatic_ticket_purchase-master/Automatic_ticket_purchase-master/Automatic_ticket_purchase.py", line 235, in run
self.login_cookies = tools.account_login('account', self.login_id, self.login_password)
File "C:\Users\ATiS\Downloads\Automatic_ticket_purchase-master\Automatic_ticket_purchase-master\tools.py", line 105, in account_login
driver.find_element_by_name('fm-login-id').send_keys(login_id)
AttributeError: 'WebDriver' object has no attribute 'find_element_by_name'
进程已结束,退出代码1
大麦网页版已经不让抢了 渠道直接被封了
看到大佬16号提交了代码,是专门为抢周杰伦南京站演唱会门票更新的吧,有票吗?
使用了好几段 replace,挺好奇大佬是如何发现并替换的,思路如何,望回复,感恩
def get_api_param(self):
""" 获取请求大麦API所必须的一些参数, 可能大麦网js代码更新后需要修改此函数内的代码以重新获得参数信息 """
def format_param(context):
param = []
for line in context.split(','):
k, v = line.split(':')
param.append('"{}":{}'.format(k, v))
param = json.loads('{' + ','.join(param) + '}')
return param
js_code_define = self.session.get(
"https://g.alicdn.com/damai/??/vue-pc/0.0.70/vendor.js,vue-pc/0.0.70/perform/perform.js").text
# 获取商品SKU的API参数
commodity_param = re.search('getSkuData:function.*?\|\|""}}', js_code_define).group()
commodity_param = re.search('data:{.*?\|\|""}}', commodity_param).group()
commodity_param = commodity_param.replace('data:{', ''). \
replace('this.vmSkuData.privilegeId||""}}', '""'). \
replace('itemId:e', 'itemId:""')
commodity_param = format_param(commodity_param)
# 获取订单购买用户的API参数
ex_params = re.search(',i=Z}else{.*?;e&&', js_code_define).group()
ex_params = re.search('{.*}', ex_params).group()
ex_params = ex_params.replace('{var u=', '')[1:-1]
ex_params = format_param(ex_params)
return commodity_param, ex_params
up主 这个脚本现在是不是用不了啦,网页dom结构变更了,现在多了一个扫码,以及下面的立即购买
chromedriver_windows目录已经是everyone可读写权限了,为什么还会报错。
`C:\Automatic_ticket_purchase>python Automatic_ticket_purchase.py
Traceback (most recent call last):
File "C:\Python3.10.9\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Python3.10.9\lib\subprocess.py", line 971, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Python3.10.9\lib\subprocess.py", line 1440, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] 拒绝访问。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Automatic_ticket_purchase\Automatic_ticket_purchase.py", line 315, in
a.run()
File "C:\Automatic_ticket_purchase\Automatic_ticket_purchase.py", line 235, in run
self.login_cookies = tools.account_login('account', self.login_id, self.login_password)
File "C:\Automatic_ticket_purchase\tools.py", line 100, in account_login
driver = webdriver.Chrome(chromedriver, options=option)
File "C:\Python3.10.9\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init
self.service.start()
File "C:\Python3.10.9\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver_windows' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
`
有多个购票人的时候会显示“购票人信息选中失败,自行查看元素位置”问题 但是选中第二个观影人的解析应该是没错的啊 求助
windows11
Python:3.11
Chrome:110.0.5481.178 (正式版本) (64 位) (cohort: Stable)
Chrome驱动:
[23588:3980:0228/222313.167:ERROR:device_event_log_impl.cc(218)] [22:23:13.167] USB: usb_device_handle_win.cc:1046 Failed to read descriptor from node connection: 连到 系统上的设备没有发挥作用。 (0x1F)
[23588:3980:0228/222313.182:ERROR:device_event_log_impl.cc(218)] [22:23:13.182] USB: usb_device_handle_win.cc:1046 Failed to read descriptor from node connection: 连到 系统上的设备没有发挥作用。 (0x1F)
[8884:22796:0228/222318.512:ERROR:ssl_client_socket_impl.cc(985)] handshake failed; returned -1, SSL error code 1, net_error -100
[8884:22796:0228/222328.699:ERROR:ssl_client_socket_impl.cc(985)] handshake failed; returned -1, SSL error code 1, net_error -100
[8884:22796:0228/222339.825:ERROR:ssl_client_socket_impl.cc(985)] handshake failed; returned -1, SSL error code 1, net_error -100
[8884:22796:0228/222350.031:ERROR:ssl_client_socket_impl.cc(985)] handshake failed; returned -1, SSL error code 1, net_error -100
[8884:22796:0228/222402.886:ERROR:ssl_client_socket_impl.cc(985)] handshake failed; returned -1, SSL error code 1, net_error -100
[8884:22796:0228/222413.050:ERROR:ssl_client_socket_impl.cc(985)] handshake failed; returned -1, SSL error code 1, net_error -100
[24140:12836:0228/222508.184:ERROR:gpu_init.cc(523)] Passthrough is not supported, GL is disabled, ANGLE is
想抢七月份五月天的门票
登录时显示:ST验证失败:调用havana服务验证STr失败
try:
self.driver.find_elements_by_xpath(
'//html//body//div[@Class = "perform__order__price"]//div[2]//div//div//a[2]')[
0].click() # 购票数+1(若需要)
except:
print("购票数添加失败")
大麦现在很多演出都不支持在www.daimai.cn上面买,这个脚本支持移动端大麦m.daimai.cn吗?
step3_submit_order方法最后buy_status返回如下数据:
{'ret': ['FAIL_SYS_USER_VALIDATE', 'RGV587_ERROR::SM::哎哟喂,被挤爆啦,请稍后重试'], 'data': {'url': 'https://buy.damai.cn:443//multi/trans/createOrder/_____tmd_____/punish?x5secdata=xb6568394a27256ea09b2af72d5497d1ae1677477069a-717315356a1926515014abaac2di53586375a__bx__buy.damai.cn%3A443%2Fmulti%2Ftrans%2Fcreaep=2'}}
购买参数必备异常是不是说明没抢到,再运行就直接报缺货了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.