Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report