python抢购软件/插件/脚本附完整源码
程序员文章站
2022-06-23 08:09:16
距上篇关于淘宝抢购源码的文章已经过去五个月了,五个月来我通过不停的学习,掌握了更深层的抢购技术及原理,而上篇文章中我仅分享了关于加入购物车的商品的抢购源码,且有部分不足。博主不提供任何服务器端程序,也...
距上篇关于淘宝抢购源码的文章已经过去五个月了,五个月来我通过不停的学习,掌握了更深层的抢购技术及原理,而上篇文章中我仅分享了关于加入购物车的商品的抢购源码,且有部分不足。
博主不提供任何服务器端程序,也不提供任何收费抢购软件。该文章仅作为学习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()
到此这篇关于python抢购软件/插件/脚本附完整源码的文章就介绍到这了,更多相关python抢购源码内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!