淘宝准点秒杀脚本
阿里云服務(wù)器
云小站_專享特惠_云產(chǎn)品推薦-阿里云
推薦一個(gè)薅羊毛教程地址:程序工廠
腳本技術(shù)交流群:212796668
開始教程
準(zhǔn)備軟件
下載地址 :?python腳本運(yùn)行環(huán)境.zip_python腳本執(zhí)行未安裝庫(kù)-Python工具類資源-CSDN下載
pycharm文件太大,不好上傳 ,直接去官網(wǎng)下載:Download PyCharm: Python IDE for Professional Developers by JetBrains
配置環(huán)境
1.安裝python
雙擊
然后跟著感覺走,
創(chuàng)建一個(gè)專門的文件夾用來(lái)放python環(huán)境
安裝好
2..安裝pycharm
1、首先去Pycharm官網(wǎng),或者直接輸入網(wǎng)址:http://www.jetbrains.com/pycharm/download/#section=windows,下載PyCharm安裝包,根據(jù)自己電腦的操作系統(tǒng)進(jìn)行選擇,對(duì)于windows系統(tǒng)選擇下圖的框框所包含的安裝包。
破解涉嫌版權(quán)問(wèn)題,請(qǐng)自行解決
3.安裝火狐瀏覽器、火狐瀏覽器安裝FireBug插件
(可以換谷歌瀏覽器和驅(qū)動(dòng),教程類似)
火狐瀏覽器
雙擊?Firefox-latest 安裝?火狐瀏覽器
FireBug插件
右上角 附加組件 > 擴(kuò)展 > 搜索?FireBug
選擇?Omnibug 安裝
按F12 出現(xiàn)下圖 ,安裝成功
4.geckodriver 驅(qū)動(dòng)安裝?
1.解壓geckodriver-v0.26.0-win64?
2.將 geckodriver 放到 該瀏覽器可執(zhí)行文件的路徑下
3.添加到環(huán)境變量中
4.將 geckodriver 放到 該python可執(zhí)行文件的路徑下
測(cè)試配置是否完成
用pycharm創(chuàng)建一個(gè)python項(xiàng)目
File > Settings > project: ms > project interpreter
添加selectninm 和 urlib3
新建一個(gè)python文件
# -*- coding: utf-8 -*- from selenium import webdriver driver = webdriver.Firefox() driver.get("https://www.baidu.com")右鍵 執(zhí)行
瀏覽器自動(dòng)打開 進(jìn)入百度
完成配置
淘寶秒殺程序
二維碼登錄
#!/usr/bin/env python # -*- coding: utf-8 -*- # 2018/09/05 # 淘寶秒殺腳本,掃碼登錄版 import os from selenium import webdriver import datetime import time from os import path from selenium.webdriver.common.action_chains import ActionChainsd = path.dirname(__file__) abspath = path.abspath(d)driver = webdriver.Firefox() driver.maximize_window()def login():# 打開淘寶登錄頁(yè),并進(jìn)行掃碼登錄driver.get("https://www.taobao.com")time.sleep(3)if driver.find_element_by_link_text("親,請(qǐng)登錄"):driver.find_element_by_link_text("親,請(qǐng)登錄").click()print("請(qǐng)?jiān)?0秒內(nèi)完成掃碼")time.sleep(30)driver.get("https://cart.taobao.com/cart.htm")time.sleep(3)# 點(diǎn)擊購(gòu)物車?yán)锶x按鈕# if driver.find_element_by_id("J_CheckBox_939775250537"):# driver.find_element_by_id("J_CheckBox_939775250537").click()# if driver.find_element_by_id("J_CheckBox_939558169627"):# driver.find_element_by_id("J_CheckBox_939558169627").click()if driver.find_element_by_id("J_SelectAll1"):driver.find_element_by_id("J_SelectAll1").click()now = datetime.datetime.now()print('login success:', now.strftime('%Y-%m-%d %H:%M:%S:%f'))def buy(buytime):while True:now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')print("當(dāng)前時(shí)間" + now)# 對(duì)比時(shí)間,時(shí)間到的話就點(diǎn)擊結(jié)算if now > buytime:try:# 點(diǎn)擊結(jié)算按鈕if driver.find_element_by_id("J_Go"):driver.find_element_by_id("J_Go").click()driver.find_element_by_link_text('提交訂單').click()except:time.sleep(0.1)print(now)time.sleep(0.1)if __name__ == "__main__":# times = input("請(qǐng)輸入搶購(gòu)時(shí)間:")# 時(shí)間格式:"2018-09-06 11:20:00.000000"login()buy("2019-11-10 01:14:00.000000")賬號(hào)密碼登錄
#!/usr/bin/env python # -*- coding: utf-8 -*- # 2018/09/05 # 淘寶秒殺腳本,掃碼登錄版 import os from selenium import webdriver import datetime import time from os import path from selenium.webdriver.common.action_chains import ActionChainsd = path.dirname(__file__) abspath = path.abspath(d)driver = webdriver.Firefox() driver.maximize_window()def login(uname, pwd):driver.get("https://www.taobao.com")if driver.find_element_by_link_text("親,請(qǐng)登錄"):driver.find_element_by_link_text("親,請(qǐng)登錄").click()input(uname, pwd)# 點(diǎn)擊購(gòu)物車?yán)锶x按鈕if driver.find_element_by_id("J_SelectAll1"):driver.find_element_by_id("J_SelectAll1").click()# time.sleep(3)now = datetime.datetime.now()print('login success:', now.strftime('%Y-%m-%d %H:%M:%S'))def input(uname, pwd):time.sleep(3)# 選擇密碼登錄if driver.find_element_by_id("J_Quick2Static"):driver.find_element_by_id("J_Quick2Static").click()time.sleep(3)# 用戶名輸入if driver.find_element_by_name("TPL_username"):for i in uname:driver.find_element_by_name("TPL_username").send_keys(i)time.sleep(0.5)time.sleep(3)# 密碼輸入if driver.find_element_by_name("TPL_password"):for j in pwd:driver.find_element_by_name("TPL_password").send_keys(j)time.sleep(0.5)time.sleep(3)# 點(diǎn)擊登錄按鈕if driver.find_element_by_id("J_SubmitStatic"):driver.find_element_by_id("J_SubmitStatic").click()time.sleep(3)driver.get("https://cart.taobao.com/cart.htm")time.sleep(2)def buy(buytime):while True:now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')if now == buytime:try:# 點(diǎn)擊結(jié)算按鈕if driver.find_element_by_id("J_Go"):driver.find_element_by_id("J_Go").click()driver.find_element_by_link_text('提交訂單').click()except:time.sleep(1)print(now)time.sleep(1)if __name__ == "__main__":# 中文賬號(hào)記得decode編碼login("賬號(hào)", '密碼')buy('2019-11-10 01:01:01.000001')阿里云服務(wù)器優(yōu)化購(gòu)買鏈接
云小站_專享特惠_云產(chǎn)品推薦-阿里云
腳本技術(shù)交流群:212796668
總結(jié)
- 上一篇: 认知无线电的能量检测
- 下一篇: [jQuery] 针对jQuery性能的