python抢购软件/插件/脚本附完整源码
作者:白夜鬼魅 时间:2021-04-25 22:03:17
距上篇关于淘宝抢购源码的文章已经过去五个月了,五个月来我通过不停的学习,掌握了更深层的抢购技术及原理,而上篇文章中我仅分享了关于加入购物车的商品的抢购源码,且有部分不足。
博主不提供任何服务器端程序,也不提供任何收费抢购软件。该文章仅作为学习selenium框架及GUI开发的一个示例代码。该思路可运用到其他任何网站,京东,天猫,淘宝均可使用,且不属于 * 或者软件之类,只属于一个自动化点击工具,如有侵犯到任何公司的合法权益,请私信联系,会第一时间将相关代码给予删除。
本篇文章我将附上完整源码,及其图形化开发的源码,及加密源码。代码稍长,如有疑惑可站内私信联系博主。
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#made in white-night
#coding=utf-8
import re
from PyQt5.QtWidgets import *
import sys
from PyQt5 import QtCore, QtWidgets
from selenium import webdriver
import datetime
import time
import threading
import wmi
class LoginDlg(QDialog):
def __init__(self, parent=None):
super(LoginDlg, self).__init__(parent)
usr = QLabel("请选择抢购方式:")
pwd = QLabel("请输入抢购时间:")
self.lineEdit = QLineEdit("",self)
self.lb0 = QLabel("请输入待抢购网址:", self)
self.lbl = QLabel("等待选择抢购方案", self)
self.lb2 = QLabel("机器码:", self)
self.lb3 = QLabel("授权码:", self)
self.lb4 = QLabel("(获取授权请加群:462510942)", self)
self.lb5 = QLabel("(请勿更改机器码,否则无法授权)", self)
self.lineEdit2 = QLineEdit("", self)
self.lineEdit1 = QLineEdit("", self)
self.combo = QComboBox(self)
self.combo.addItem("0、请选择抢购方案")
self.combo.addItem("1、加购物车")
self.combo.addItem("2、不加购物车")
self.combo.addItem("3、抢购优惠券")
# self.lineEdit.move(200,100)
self.lb0.move(50, 100)
self.lbl.move(50, 150)
self.lb2.move(50, 200)
self.lb3.move(50, 250)
self.lb4.move(250, 250)
self.lb5.move(250, 200)
self.lineEdit2.move(100, 200)
self.lineEdit1.move(100, 250)
self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('QComboBox')
self.show()
self.dateTimeEdit = QtWidgets.QDateTimeEdit()
self.dateTimeEdit.setGeometry(QtCore.QRect(140, 50, 121, 22))
self.dateTimeEdit.setDateTime(QtCore.QDateTime(QtCore.QDate(2018, 11, 1), QtCore.QTime(9, 0, 0)))
self.dateTimeEdit.setObjectName("dateTimeEdit")
gridLayout = QGridLayout()
gridLayout.addWidget(usr, 0, 0, 1, 1)
gridLayout.addWidget(pwd, 1, 0, 1, 1)
gridLayout.addWidget(self.lb0, 2, 0, 1, 1)
gridLayout.addWidget(self.combo, 0, 1, 1, 3)
gridLayout.addWidget(self.dateTimeEdit, 1, 1, 1, 3)
gridLayout.addWidget(self.lineEdit, 2, 1, 1, 3)
sqBtn = QPushButton("授权")
okBtn = QPushButton("确定")
cancelBtn = QPushButton("关闭软件")
btnLayout = QHBoxLayout()
btnLayout.setSpacing(60)
btnLayout.addWidget(okBtn)
btnLayout.addWidget(cancelBtn)
btnLayout.addWidget(sqBtn)
dlgLayout = QVBoxLayout()
dlgLayout.setContentsMargins(40, 40, 40, 40)
dlgLayout.addLayout(gridLayout)
dlgLayout.addStretch(40)
dlgLayout.addLayout(btnLayout)
self.setLayout(dlgLayout)
okBtn.clicked.connect(self.accept)
cancelBtn.clicked.connect(self.reject)
sqBtn.clicked.connect(self.cpuid)
self.setWindowTitle("VN辅助抢购软件")
self.resize(600, 400)
self.thread_handle = None
def thread_function(self,index):
# 需要在线程加一个全局变量的判断 用于终止死循环 用来切换方案
data = self.cpuid1[2] + self.cpuid1[5] + min(self.cpuid1) + self.cpuid1[-5] + self.cpuid1[1] + self.cpuid1[3] + self.cpuid1[4] + max(self.cpuid1) + self.cpuid1[1] + \
self.cpuid1[-1] + self.cpuid1[-3] + "V" + "N" + self.cpuid1[-2] + self.cpuid1[0] + self.cpuid1[-4]
if self.lineEdit1.text() == data and self.lineEdit2.text() == self.cpuid1:
if index==0:
self.lbl.setText("请选择抢购方案,然后点击确定")
elif index==1:
self.lbl.setText("成功调用加购物车方案")
self.gouwubuy()
elif index==2:
self.lbl.setText("成功调用不加购物车方案")
self.buy()
else:
self.lbl.setText("成功调用抢券方案")
self.quanbuy()
else:
self.lbl.setText("请输入正确的授权码")
def accept(self):
# 线程创建
self.thread_handle = threading.Thread(target=LoginDlg.thread_function,args=(self,self.combo.currentIndex()))
self.thread_handle.start()
return
def gouwubuy(self):
browser.get("https://cart.taobao.com/cart.htm")
# 点击购物车里全选按钮
buyt = self.dateTimeEdit.text()
buyti = re.findall(" (.*)",buyt)
buytime = buyti[0]+":00.000000"
while True:
now = datetime.datetime.now().strftime('%H:%M:%S.%f')
# 对比时间,时间到的话就点击结算
if now > buytime:
# 点击结算按钮
try:
if browser.find_element_by_id("J_Go"):
browser.find_element_by_id("J_Go").click()
except:
pass
try:
if browser.find_element_by_link_text('提交订单'):
browser.find_element_by_link_text('提交订单').click()
now1 = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
self.lbl.setText("提交订单时间为:%s"% now1)
except:
pass
def buy(self):
browser.get(self.lineEdit.text())
while True:
try:
if browser.find_element_by_link_text('立即购买'):
browser.find_element_by_link_text('立即购买').click()
except:
pass
try:
if browser.find_element_by_link_text('提交订单'):
browser.find_element_by_link_text('提交订单').click()
now1 = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
self.lbl.setText("提交订单时间为:%s" % now1)
break
except:
pass
def quanbuy(self):
browser.get(self.lineEdit.text())
while True:
now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
# 对比时间,时间到的话就点击结算
try:
if browser.find_element_by_link_text('立刻抢'):
browser.find_element_by_link_text('立刻抢').click()
except:
pass
try:
if browser.find_element_by_link_text('点击领券'):
browser.find_element_by_link_text('点击领券').click()
except:
pass
def cpuid(self):
w = wmi.WMI()
cpus = w.Win32_Processor()
for u in cpus:
self.cpuid1 = u.ProcessorId
self.lineEdit2.setText(self.cpuid1)
def login():
# 打开淘宝登录页,并进行扫码登录
browser.get("https://www.taobao.com")
time.sleep(3)
if browser.find_element_by_link_text("亲,请登录"):
browser.find_element_by_link_text("亲,请登录").click()
time.sleep(3)
if __name__ == '__main__':
browser = webdriver.Chrome()
browser.maximize_window()
login()
app = QApplication(sys.argv)
dlg = LoginDlg()
dlg.show()
dlg.exec_()
app.exit()
来源:https://blog.csdn.net/shuryuu/article/details/88049893
标签:python,抢购,源码
0
投稿
猜你喜欢
sqlserver 存储过程分页(按多条件排序)
2024-01-23 15:56:31
wireshark捕获过滤器语法使用解析
2022-04-24 04:52:53
python网络编程:socketserver的基本使用方法实例分析
2023-11-26 21:33:50
MySQL UPDATE时主键冲突引发的思考
2008-06-21 17:00:00
如何利用Python开发一个简单的猜数字游戏
2022-05-21 20:38:08
Python实现哲学家就餐问题实例代码
2022-09-20 14:10:49
微信小程序实现富文本图片宽度自适应的方法
2023-10-17 12:44:25
.Net中控件的命名规则
2024-06-05 09:25:15
python实现画桃心表白
2021-05-14 16:27:00
Golang 高效排序数据详情
2023-06-23 08:23:41
Tensorflow矩阵运算实例(矩阵相乘,点乘,行/列累加)
2023-12-19 04:07:42
ORACLE中段的HEADER_BLOCK示例详析
2024-01-26 02:35:09
使用Python操作PDF文件
2022-01-01 06:15:12
深入了解javascript中的prototype与继承
2024-04-23 09:13:10
浅析Python中的赋值和深浅拷贝
2021-09-10 14:30:14
python实现WebSocket服务端过程解析
2022-09-14 10:45:19
跟老齐学Python之开始真正编程
2021-06-26 21:42:22
python 字典的概念叙述和使用方法
2021-11-08 00:42:06
Pytorch 如何实现LSTM时间序列预测
2023-06-26 01:04:24
Python人工智能深度学习模型训练经验总结
2022-01-05 18:10:50