【Python x Taobao】淘宝秒杀抢购脚本 |
您所在的位置:网站首页 › ps5b站抢购脚本 › 【Python x Taobao】淘宝秒杀抢购脚本 |
准备好谷歌浏览器,以及对应的driver 安装好插件selenium 进入chromedriver.exe所在的文件夹 比如我的在“D:\Test\” 文件夹 命令行输入: D:\ cd Test 运行脚本 ![]() main.py ![]() # encoding = "utf-8" # !/usr/bin/env python3 from selenium import webdriver import time import threading class buy_thread(threading.Thread): def __init__(self, driver): threading.Thread.__init__(self) self.daemon = True self.driver = driver def run(self): while True: if '时间,注意全为英文符号,格式为:00:00:00' in str(time.asctime()): while True: try: self.driver.find_element_by_link_text("立即购买").click() break except Exception as e: print(e) while True: try: self.driver.find_element_by_link_text('提交订单').click() input() except Exception as e: print(e) time.sleep(0.01) def main(): driver = webdriver.Chrome() driver.get("https://www.taobao.com/") driver.find_element_by_link_text("亲,请登录").click() #等待用户登录 while True: if not "login.taobao.com" in driver.current_url: break time.sleep(0.5) #开始进入页面 driver.get("商品所在的页面") #调起多线程 threads = buy_thread(driver) threads.start() threads.join() driver.quit() if __name__ == '__main__': main() ![]() 锵锵~ |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |