抓取淘宝商品详情价格接口代码封装如下:
请求方式:HTTPS POST GET
公共参数
名称 类型 必须 描述
key String 是 调用key(必须以GET方式拼接在URL中)API 接口 API 接口
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版本
请求参数
请求参数:num_iid=589554336545&is_promotion=1
参数说明:num_iid:淘宝商品ID
is_promotion:是否获取取促销价
请求示例Curl PHP PHPsdk JAVA C# Python
<?php
// 请求示例 url 默认请求参数已经URL编码处理
// 本示例代码未加密secret参数明文传输,若要加密请参考:https://open.onebound.cn/help/demo/sdk/demo-sign.php
$method = "GET";
$url = "https://api-gw.onebound.cn/taobao/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=652874751412&is_promotion=1";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
var_dump(curl_exec($curl));
?>
响应示例
{
"item": {
"num_iid": "589554336545",
"title": "女童夏装连衣裙2021新款儿童中大童文艺森系宽松短袖纯棉长裙亲子",
"desc_short": "",
"price": 85,
"total_price": "",
"suggestive_price": "",
"orginal_price": 170,
"nick": "舒服的小窝",
"num": 147,
"detail_url": "https://item.taobao.com/item.htm?id=589554336545",
"pic_url": "//gd4.alicdn.com/imgextra/i4/682244761/O1CN015umZZl1l2aG1rw7WU_!!682244761.jpg",
"brand": null,
"brandId": "",
"rootCatId": "",
"cid": 121452038,
"desc": "",
"item_imgs": [
{
"url": "//gd4.alicdn.com/imgextra/i4/682244761/O1CN015umZZl1l2aG1rw7WU_!!682244761.jpg"
},
{
"url": "//gd3.alicdn.com/imgextra/i3/682244761/O1CN01eQEHrh1l2aB7f0yoR_!!682244761.jpg"
},
{
"url": "//gd2.alicdn.com/imgextra/i2/682244761/O1CN01YQxPal1l2aB5ph2ms_!!682244761.jpg"
},
{
"url": "//gd4.alicdn.com/imgextra/i4/682244761/O1CN01asJMPJ1l2aB51VgZK_!!682244761.jpg"
},
{
"url": "//gd4.alicdn.com/imgextra/i4/682244761/O1CN01IVEX8V1l2aQKZT4V7_!!0-item_pic.jpg"
}
],
"item_weight": "",
"post_fee": 0,
"freight": "",
"express_fee": "",
"ems_fee": "",
"shipping_to": "",
"video": {
"url": null
},
"sample_id": "",
"props_name": "1627207:101620863:颜色分类:米色裙子 偏大宽松;1627207:101620863:颜色分类:米色裙子 偏大宽松;1627207:101620863:颜色分类:米色裙子 偏大宽松;1627207:101620863:颜色分类:米色裙子 偏大宽松;1627207:101620863:颜色分类:米色裙子 偏大宽松;1627207:101620863:颜色分类:米色裙子 偏大宽松;122216343:50792021:参考身高:120cm;122216343:3285954:参考身高:130cm;122216343:3376466:参考身高:140cm;122216343:917:参考身高:150cm;122216343:26774:参考身高:160cm;122216343:3191195169:参考身高:妈妈均码-L码",
"prop_imgs": {
"prop_img": []
},
"props_imgs": {
"prop_img": []
},
"property_alias": "",
"props": [
{
"name": "品牌",
"value": "other/其他"
},
{
"name": "适用年龄",
"value": "3岁 4岁 5岁 6岁 7岁 8岁 9岁 10岁 11岁 12岁 13岁 14岁"
},
{
"name": "面料",
"value": "棉布"
},
{
"name": "图案",
"value": "纯色"
},
{
"name": "风格",
"value": "韩版"
},
{
"name": "产地",
"value": "中国大陆"
},
{
"name": "适用性别",
"value": "女"
},
{
"name": "颜色分类",
"value": "米色裙子"
},
{
"name": "裙型",
"value": "不规则"
},
{
"name": "参考身高",
"value": "妈妈均码-L码 120cm 130cm 140cm 150cm 160cm"
},
{
"name": "适用季节",
"value": "夏季"
},
{
"name": "款式",
"value": "短袖"
},
{
"name": "安全等级",
"value": "B类"
},
{
"name": "材质成分",
"value": "棉70% 其他30%"
}
],
"total_sold": "-1",
"skus": {
"sku": [
{
"price": 85,
"total_price": 0,
"orginal_price": 170,
"properties": "1627207:101620863;122216343:50792021",
"properties_name": "1627207:101620863:颜色分类:米色裙子 偏大宽松;122216343:50792021:参考身高:120cm",
"quantity": 15,
"sku_id": "4208575295008"
},
{
"price": 85,
"total_price": 0,
"orginal_price": 170,
"properties": "1627207:101620863;122216343:3285954",
"properties_name": "1627207:101620863:颜色分类:米色裙子 偏大宽松;122216343:3285954:参考身高:130cm",
"quantity": 31,
"sku_id": "4208575295006"
},
{
"price": 85,
"total_price": 0,
"orginal_price": 170,
"properties": "1627207:101620863;122216343:3376466",
"properties_name": "1627207:101620863:颜色分类:米色裙子 偏大宽松;122216343:3376466:参考身高:140cm",
"quantity": 24,
"sku_id": "4208575295007"
},
{
"price": 85,
"total_price": 0,
"orginal_price": 170,
"properties": "1627207:101620863;122216343:917",
"properties_name": "1627207:101620863:颜色分类:米色裙子 偏大宽松;122216343:917:参考身高:150cm",
"quantity": 24,
"sku_id": "4208575295010"
},
{
"price": 85,
"total_price": 0,
"orginal_price": 170,
"properties": "1627207:101620863;122216343:26774",
"properties_name": "1627207:101620863:颜色分类:米色裙子 偏大宽松;122216343:26774:参考身高:160cm",
"quantity": 24,
"sku_id": "4208575295004"
},
{
"price": 85,
"total_price": 0,
"orginal_price": 170,
"properties": "1627207:101620863;122216343:3191195169",
"properties_name": "1627207:101620863:颜色分类:米色裙子 偏大宽松;122216343:3191195169:参考身高:妈妈均码-L码",
"quantity": 29,
"sku_id": "4208575295005"
}
]
},
"seller_id": "682244761",
"sales": 0,
"shop_id": "65785458",
"props_list": {
"1627207:101620863": "颜色分类:米色裙子 偏大宽松",
"122216343:50792021": "参考身高:120cm",
"122216343:3285954": "参考身高:130cm",
"122216343:3376466": "参考身高:140cm",
"122216343:917": "参考身高:150cm",
"122216343:26774": "参考身高:160cm",
"122216343:3191195169": "参考身高:妈妈均码-L码"
},
"seller_info": {
"nick": "舒服的小窝",
"item_score": 4.9041,
"score_p": 4.92365,
"delivery_score": 4.93017,
"shop_type": "",
"user_num_id": "682244761",
"sid": "65785458",
"title": "",
"zhuy": "https://shop65785458.taobao.com",
"cert": null,
"open_time": "12年老店",
"credit_score": "tb-rank-crown:1",
"shop_name": "希希公主精品童装"
},
"tmall": false,
"error": "",
"location": "江苏扬州",
"data_from": "Ha",
"has_discount": "true",
"is_promotion": "true",
"promo_type": null,
"props_img": [],
"format_check": "ok",
"desc_img": [],
"shop_item": [],
"relate_items": []
},
"error": "",
"secache": "3f7ddd24643ac7887bfa3acf7eac465a",
"secache_time": 1684999164,
"secache_date": "2023-05-25 15:19:24",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},