一、淘宝天猫实时销量API接口(item_get_sales - 获取商品销量详情接口),实时销量接口主要是用于监控淘宝天猫的商品销量变化,可以获取到商品ID,商品链接,标题,价格,图片链接,库存数量,价格,30天销量,总销量等参数,页面上有的数据可以拿到,接口代码对接如下:
1.公共参数
名称 | 类型 | 必须 | 描述 |
key | String | 是 | 调用key(必须以GET方式拼接在URL中,点击获取测试key和secret) |
secret | String | 是 | 调用密钥 |
api_name | String | 是 | API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等] |
cache | String | 否 | [yes,no]默认yes,将调用缓存的数据,速度比较快 |
result_type | String | 否 | [json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读 |
lang | String | 否 | [cn,en,ru]翻译语言,默认cn简体中文 |
version | String | 否 | API版本 |
2.请求参数
num_iid:淘宝商品ID num_iid=520813250866
3.请求参数(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://vx19970108018/taobao/item_get-sales/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=520813250866&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)
4.响应示例
{
"item": [
{
"num_iid": "520813250866",
"detail_url": "http://item.taobao.com/item.htm?id=520813250866",
"title": "三刃木折叠刀创意迷你钥匙扣钥匙刀户外随身多功能锋利开箱小刀",
"price": "25.80",
"pic_url": "http://img.alicdn.com/i3/2596264565/O1CN01L8HLol1jaonor67d8_!!2596264565.jpg",
"quantity": "200",
"preSellPrice": "",
"promotion_price": "22.70",
"sales_30day": "23",
"total_sales": "4201"
}
],
"data_from": "app_vip",
"error": "",
"reason": "",
"error_code": "0000",
"cache": 0,
"api_info": "today:158 max:10100 all[276=158+57+61];expires:2030-12-31",
"execution_time": "0.557",
"server_time": "Beijing/2022-06-28 17:36:24",
"client_ip": "106.6.37.183",
"call_args": [],
"api_type": "taobao",
"translate_language": "zh-CN",
"translate_engine": "google_new",
"server_memory": "5.81MB",
"request_id": "gw-1.62bacb97b50b0",
"last_id": "1046087440"
}
标签:__,get,销量,接口,item,API
From: https://blog.51cto.com/u_16175140/6925314