源代碼可參考作者:https://github.com/huanghyw/jd_seckill
由于專案遵循GPL-3.0 License協議,明確專案內所有資源檔案,禁止任何公眾號、自媒體進行任何形式的轉載、發布,故不寫長篇篇幅來描述代碼內容,
基于原作者的描述和本人的親身實戰,確實可以搶到茅臺,
如有小白以及python入門者不懂詳情,可以幫忙指導,搶購茅臺,
#反復結算
def auto_check(self,times):
while True:
try:
if driver.find_element_by_id('J_SelectAll1'):
driver.find_element_by_id('J_SelectAll1').click()
time.sleep(0.5)
break
except:
time.sleep(0.5)
pass
while True:
if datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') >= times:
while True:
try:
driver.find_element_by_id("J_Go").click()
print("成功結算")
driver.find_element_by_link_text('提交訂單').click()
print(f"搶購成功,請盡快付款")
time.sleep(5)
return 0
except:
print("無法結算,重試")
time.sleep(1)
driver.get("https://cart.taobao.com/cart.htm")
self.auto_check(times)
def auto_check1(self,times):
while True:
if datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f') >= times:
while True:
try:
driver.find_element_by_id("J_Go").click()
print("成功結算")
driver.find_element_by_link_text('提交訂單').click()
print(f"搶購成功,請盡快付款")
time.sleep(5)
return 0
except:
print("無法結算,重試")
time.sleep(1)
driver.get("https://cart.taobao.com/cart.htm")
self.auto_check(times)
# 運行
def run_driver(self, num, pwd, times):
self.login_in(num, pwd, times)
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/241851.html
標籤:python
上一篇:python基礎例題
