通过商品ID请求封装接口商品详情接口,详情API接口,sku价格接口,详情属性接口,销量接口等可以获取到详情页面上的参数数据包括:商品标题,商品图片,sku价格,区间价,最小起批量,库存,属性图片,详情图,销量,店铺昵称,商品所在地等页面上有的数据均可以拿到,大家都知道,淘宝的机制十分严,而很多时候,没办法高效的拿到数据内容响应终端需求,而依赖爬虫就会造成动不动就出现滑块验证,让人很无解,正好,公司有这样的需求,让我负责解决这个问题,刚开始各种尝试,始终没有绕过拼多多的滑块验证码,搞了好几天,都没有进展;
然后各种网上资料查询,最终还是不负努力,找到更好的解决方案,让采集不再出现任何滑块验证码,完全解密通过,实现更好的用户体验,已经封装成了淘宝商品详情页API接口,可以用于不同的业务场景,包括1688详情接口,京东详情接口,抖音详情接口,小红书详情接口,拼多多详情接口 均可以适用,希望能够帮助到有需要的朋友,下面是接口代码对接展示:
1.公共参数:
名称 | 类型 | 必须 | 描述 |
---|---|---|---|
key | String | 是 | 调用key 点击获取测试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=520813250866&is_promotion=1
参数说明:num_iid:淘宝商品ID
is_promotion:是否获取取促销价
3.请求示例:
# 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.onebound.cn/taobao/item_get/?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",
"title": "三刃木折叠刀创意迷你钥匙扣钥匙刀户外随身多功能锋利开箱小刀",
"desc_short": "",
"price": "22.7",
"total_price": 0,
"suggestive_price": 0,
"orginal_price": "25.80",
"nick": "欢乐购客栈",
"num": "200",
"min_num": 0,
"detail_url": "https://item.taobao.com/item.htm?id=520813250866",
"pic_url": "//img.alicdn.com/imgextra/i3/2596264565/O1CN01L8HLol1jaonor67d8_!!2596264565.jpg",
"brand": "三刃木",
"brandId": "4036703",
"rootCatId": "50013886",
"cid": "50014822",
"crumbs": [],
"created_time": "",
"modified_time": "",
"delist_time": "",
"desc": "",
"desc_img": [
"http://img.alicdn.com/imgextra/i2/2596264565/TB2nAHqgyC9MuFjSZFoXXbUzFXa_!!2596264565.jpg",
"http://img.alicdn.com/imgextra/i3/2596264565/TB2ahCelVXXXXc_XXXXXXXXXXXX_!!2596264565.jpg",
"http://img.alicdn.com/imgextra/i4/2596264565/O1CN01wp8a2f1jaomde1XlL_!!2596264565.jpg",
"http://img.alicdn.com/imgextra/i1/2596264565/TB2sGR3lVXXXXblXpXXXXXXXXXX_!!2596264565.jpg",
"http://img.alicdn.com/imgextra/i1/2596264565/TB2ZBGxlVXXXXXMXXXXXXXXXXXX_!!2596264565.jpg",
"http://img.alicdn.com/imgextra/i1/2596264565/TB2MjWklVXXXXcaXXXXXXXXXXXX_!!2596264565.jpg",
"http://img.alicdn.com/imgextra/i2/2596264565/TB2UgV3lVXXXXbdXpXXXXXXXXXX_!!2596264565.jpg",
"http://img.alicdn.com/imgextra/i2/2596264565/TB2ip5XlVXXXXX2XpXXXXXXXXXX_!!2596264565.jpg"
],
"item_imgs": [
{
"url": "//img.alicdn.com/imgextra/i3/2596264565/O1CN01L8HLol1jaonor67d8_!!2596264565.jpg"
},
{
"url": "//img.alicdn.com/imgextra/i1/2596264565/O1CN01jcuVBb1jaomeRuMkL_!!0-item_pic.jpg"
},
{
"url": "//img.alicdn.com/imgextra/i3/2596264565/O1CN01T1p7hu1jaomklDXvC_!!0-item_pic.jpg"
},
{
"url": "//img.alicdn.com/imgextra/i4/2596264565/O1CN01xbHROv1jaomde2Ldu_!!0-item_pic.jpg"
},
{
"url": "//img.alicdn.com/imgextra/i3/2596264565/O1CN018BhMpU1jaomhACP0K_!!0-item_pic.jpg"
}
],
"item_weight": "",
"item_size": "",
"location": "广东深圳",
"post_fee": 0,
"express_fee": null,
"ems_fee": "",
"shipping_to": "",
"has_discount": "true",
"video": [],
"is_virtual": "",
"sample_id": "",
"is_promotion": "true",
"props_name": "1627207:12227458263:颜色分类:长方形带开瓶器+送卡片刀+钢圈;1627207:12227458264:颜色分类:椭圆形带开瓶器+送卡片刀+钢圈;1627207:12227458265:颜色分类:GJ018X钥匙刀+送卡片刀+钢圈",
"prop_imgs": {
"prop_img": [
{
"properties": "1627207:12227458263",
"url": "//img.alicdn.com/imgextra/i3/2596264565/TB2.XeblVXXXXXkXpXXXXXXXXXX_!!2596264565.jpg"
},
{
"properties": "1627207:12227458264",
"url": "//img.alicdn.com/imgextra/i4/2596264565/TB2dTrjdVXXXXXBXpXXXXXXXXXX_!!2596264565.jpg"
},
{
"properties": "1627207:12227458265",
"url": "//img.alicdn.com/imgextra/i2/2596264565/TB2j22kdVXXXXXdXpXXXXXXXXXX_!!2596264565.jpg"
}
]
},
"property_alias": "",
"props": [
{
"name": "品牌",
"value": "三刃木"
},
{
"name": "产地",
"value": "中国"
},
{
"name": "颜色分类",
"value": "长方形带开瓶器+送卡片刀+钢圈,椭圆形带开瓶器+送卡片刀+钢圈,GJ018X钥匙刀+送卡片刀+钢圈"
},
{
"name": "重量",
"value": "26g(含)-50g(含)"
},
{
"name": "吊牌价",
"value": "46"
},
{
"name": "功能数量",
"value": "5个及以下"
},
{
"name": "展开长度",
"value": "10cm以下"
},
{
"name": "货号",
"value": "GJ019C"
},
{
"name": "附加功能",
"value": "刀,开瓶器,螺丝刀,钥匙圈,其他/other"
},
{
"name": "运动户外项目",
"value": "露营"
}
],
"total_sold": "132",
"skus": {
"sku": [
{
"price": "37",
"total_price": 0,
"orginal_price": "37",
"properties": "1627207:12227458263",
"properties_name": "1627207:12227458263:颜色分类:长方形带开瓶器+送卡片刀+钢圈",
"quantity": "200",
"sku_id": "3166598625985"
},
{
"price": "37",
"total_price": 0,
"orginal_price": "37",
"properties": "1627207:12227458264",
"properties_name": "1627207:12227458264:颜色分类:椭圆形带开瓶器+送卡片刀+钢圈",
"quantity": "200",
"sku_id": "3166598625984"
},
{
"price": "22.7",
"total_price": 0,
"orginal_price": "22.7",
"properties": "1627207:12227458265",
"properties_name": "1627207:12227458265:颜色分类:GJ018X钥匙刀+送卡片刀+钢圈",
"quantity": "200",
"sku_id": "3144644292458"
}
]
},
"seller_id": "2596264565",
"sales": 24,
"shop_id": "127203758",
"props_list": {
"1627207:12227458263": "颜色分类:长方形带开瓶器+送卡片刀+钢圈",
"1627207:12227458264": "颜色分类:椭圆形带开瓶器+送卡片刀+钢圈",
"1627207:12227458265": "颜色分类:GJ018X钥匙刀+送卡片刀+钢圈"
},
"seller_info": {
"nick": "欢乐购客栈",
"item_score": "4.8 ",
"score_p": "4.8 ",
"delivery_score": "4.8 ",
"shop_type": "C",
"user_num_id": "2596264565",
"sid": "127203758",
"title": "欢乐购客栈",
"zhuy": "https://shop127203758.taobao.com/",
"shop_name": "欢乐购客栈"
},
"tmall": false,
"error": "",
"warning": "",
"url_log": [],
"fav_count": "5386",
"fans_count": "1520",
"freight": "快递: 快递包邮",
"props_imgs": {
"prop_img": [
{
"properties": "1627207:12227458263",
"url": "//img.alicdn.com/imgextra/i3/2596264565/TB2.XeblVXXXXXkXpXXXXXXXXXX_!!2596264565.jpg"
},
{
"properties": "1627207:12227458264",
"url": "//img.alicdn.com/imgextra/i4/2596264565/TB2dTrjdVXXXXXBXpXXXXXXXXXX_!!2596264565.jpg"
},
{
"properties": "1627207:12227458265",
"url": "//img.alicdn.com/imgextra/i2/2596264565/TB2j22kdVXXXXXdXpXXXXXXXXXX_!!2596264565.jpg"
}
]
},
"_ddf": "xdl",
"promo_type": null,
"props_img": {
"1627207:12227458263": "//img.alicdn.com/imgextra/i3/2596264565/TB2.XeblVXXXXXkXpXXXXXXXXXX_!!2596264565.jpg",
"1627207:12227458264": "//img.alicdn.com/imgextra/i4/2596264565/TB2dTrjdVXXXXXBXpXXXXXXXXXX_!!2596264565.jpg",
"1627207:12227458265": "//img.alicdn.com/imgextra/i2/2596264565/TB2j22kdVXXXXXdXpXXXXXXXXXX_!!2596264565.jpg"
},
"format_check": "ok",
"shop_item": [],
"relate_items": []
},
"error": "",
"secache": "d8bd20b8f0d9df02dd030dd374110240",
"secache_time": 1658389257,
"secache_date": "2022-07-21 15:40:57",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"reason": "",
"error_code": "0000",
"cache": 0,
"api_info": "today:97 max:10100 all[171=97+50+34];expires:2030-12-31",
"execution_time": "1.595",
"server_time": "Beijing/2022-07-21 15:40:57",
"client_ip": "106.6.35.38",
"call_args": {
"num_iid": "520813250866",
"is_promotion": "1"
},
"api_type": "taobao",
"translate_language": "zh-CN",
"translate_engine": "google_new",
"server_memory": "0.92MB",
"request_id": "gw-4.62d9030815fcf",
"last_id": "1091608978"
}