Data collection of Taobao product details, supporting high concurrent requests

1. How to manually check the data on the Alibaba product details page      

1. Taobao Tmall product details API interface (item_get - get Taobao product details interface), Taobao API interface code docking can get product ID, product title, price, preferential price, shopkeeper name, inventory, product link, product picture, brand The data on the page such as the name, product details, and detailed pictures can be obtained, and the manual method is as follows:  

For example, we open the Taobao mobile terminal or PC terminal, search for the keyword "new dress", click on a baby at random, and enter the product details. Let's take the recommended product as an example and click to enter the product detail page.

2. Click the right mouse button to view the data parameters of the detail page obtained from the source code, including title, picture, product price, product coupon, discount information, inventory quantity, product detail page data and other parameters.  

2. Obtain the product details data of the entire station through the encapsulation interface, the code is as follows:   

Taobao.item_get - API for getting Alibaba item details data   

1. Request method: HTTP GET POST 

2. Public parameters:

name type must describe
key String yes Call key (must be spliced ​​in the URL in GET mode)
secret String yes Call key (copy v:Taobaoapi2014)
api_name String yes API interface name (included in the request address) [item_search, item_get, item_search_shop, etc.]
cache String no [yes, no] The default is yes, the cached data will be called, and the speed is relatively fast
result_type String no [json,jsonu,xml,serialize,var_export] returns the data format, the default is json, and the content output by jsonu can be read directly in Chinese
lang String no [cn,en,ru] translation language, default cn Simplified Chinese
version String no API version ( see call example )

3. Request parameters:

Request parameters: num_iid=652874751412&is_promotion=1
Parameter description: num_iid: Taobao product ID
is_promotion: whether to get the promotion price

4. Request code examples, support high concurrent requests (CURL, PHP, PHPsdk, Java, C#, Python...)

# coding:utf-8
"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
# 请求示例 url 默认请求参数已经做URL编码
url = "https://api-gw.Taobaoapi2014.cn/taobao/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=652874751412&is_promotion=1"
headers = {
    "Accept-Encoding": "gzip",
    "Connection": "close"
}
if __name__ == "__main__":
    r = requests.get(url, headers=headers)
    json_obj = r.json()
    print(json_obj)

5. Response example

Guess you like

Origin blog.csdn.net/weixin_64051447/article/details/130683423