Get the App
SLTechnology News&Howtos  ›  Development  › 

How to make a self-made Python Taobao Swift Buy script

Shulou Source: shulou.com Published: 2022-06-02 16:49:34 10月02日 Update

The content of this article mainly explains "how to self-make Python Taobao second-kill rush-purchase script", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "how to self-made Python Taobao second kill rush purchase script"!

Step one:

First of all, my idea is very simple, is to let the "program" to help us automatically open the browser, enter Taobao, and then go to the shopping cart to wait for rush time, automatic purchase and payment.

Step 2:

Import module, we need a time module, snap-up time, and a Python automation operation.

The code is as follows:

Import datetime # module now = datetime.datetime.now (). Strftime ('% Y-%m-%d% HGV% MGV% S.F') import time# fully automated Python code operation from selenium import webdriver

Step 3:

According to our idea, we first need the program to help us open Google browser, type "www.taobao.com", and then click login to enter the shopping cart.

The code is as follows

Times = "2021-11-04 2100VZ 00.00000000" browser = webdriver.Chrome () browser.get ("https://www.taobao.com")time.sleep(3) # Click browser.find_element_by_link_text (" dear, please log in ") .click ()

However, there is a problem here, that is, we cannot write our account and password in the code, which is easy to leak, so we can log in by scanning the code manually.

Print (f "Please log in as soon as possible") time.sleep (10) browser.get ("https://cart.taobao.com/cart.htm")time.sleep(3)"

Step 4:

Get into the shopping cart, wait for rush time and then buy.

First of all, this program can't help us choose goods, so we have to add them to the shopping cart in advance.

When it's time to rush to buy, you can buy all the goods directly.

# whether to select all shopping carts while True: try: if browser.find_element_by_id ("J_SelectAll1"): browser.find_element_by_id ("J_SelectAll1"). Click () break except: print (f "Buy button not found") while True: # get the current time of the computer Year month day now = datetime.datetime.now () .strftime ('% Y-%m-%d% Hpurs% MRV% S.% f') # comparison time If the time is up, click on the settlement print (now) # to determine whether it is time to kill. If now > times: # Click the settlement button while True: try: if browser.find_element_by_link_text ("settlement"): print ("here") browser.find_element_by_link_text ("settlement"). Click () print (f "owner, the program locks the item. Break except: pass # Click submit order button while True: try: if browser.find_element_by_link_text ('submit order'): browser.find_element_by_link_text ('submit order') .click () print (f "snapped up successfully Please pay as soon as possible ") except: print (" Master, I have helped you get the goods, you pay for it ") break time.sleep (0.01) so far, I believe you have a deeper understanding of" how to make the Python Taobao second-kill rush-purchase script ". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Time goods shopping cart shopping Taobao code programs login scripts buttons modules orders settlement success owner content that is ideas browsers learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Tech Info Redmi Docker MariaDB