写点什么

如何 item_get- 获得淘宝商品详情 api 接口

作者:Geek_975207
  • 2023-11-14
    江西
  • 本文字数:7023 字

    阅读完需:约 23 分钟

以下是使用淘宝开放平台 API 接口获取淘宝商品详情的步骤:

  1. 注册淘宝开放平台账号并创建应用,获取APP_ID和APP_SECRET。

  2. 在代码中选择使用淘宝开放平台 SDK,并使用 SDK 提供的 API 接口。

  3. 使用TaobaoSDK.init_app方法初始化 SDK,将 APP_ID 和 APP_SECRET 传递给该方法。

  4. 创建一个TaobaoSDK.Request对象,设置请求的方法为taobao.item.get,表示获取商品详情。

  5. 在请求对象中设置必要的参数,例如商品 ID(num_iid)。

  6. 使用TaobaoSDK.execute方法发送请求并获取响应。

  7. 检查响应结果,如果成功获取到商品详情,可以从响应中提取商品信息并进行处理;如果失败,可以获取错误信息进行处理。

数据示例

Result Object:---------------------------------------{	"item": {		"num_iid": "626994174781",		"title": "【神仙club】原创JK衬衫长袖春秋 月下鹤棉白色衬衣女jk制服上衣",		"desc_short": "",		"price": 95,		"total_price": "",		"suggestive_price": "",		"orginal_price": 95,		"nick": "wwj373347892",		"num": 1444,		"detail_url": "https://item.taobao.com/item.htm?id=626994174781",		"pic_url": "//gd4.alicdn.com/imgextra/i3/1025096528/O1CN01Yyuaw31y5s8gjSr6D_!!1025096528-0-lubanu-s.jpg",		"brand": "other/其他",		"brandId": "",		"rootCatId": "",		"cid": 162104,		"desc": "<p>&nbsp;</p> \n  <p>&nbsp;</p> \n  <p>&nbsp;</p> \n  <p><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i4/1025096528/O1CN01Bq49ve1y5s8ZsXDNh_!!1025096528.jpg\"  /></p> \n  <p><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01bjn1GX1y5sD60AspK_!!1025096528.jpg\"  /><img src=\"http://img.alicdn.com/imgextra/i4/1025096528/O1CN018qpdMZ1y5sE8bP7aR_!!1025096528.jpg\" usemap=\"#DIEJA\" /><img src=\"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01D8AyeT1y5sE5H2dMr_!!1025096528.jpg\" usemap=\"#QKMPV\" /><img src=\"http://img.alicdn.com/imgextra/i1/1025096528/O1CN01W20sRZ1y5sE7sapTi_!!1025096528.jpg\" usemap=\"#GDQMX\" /><map name=\"HUZCY\"></map><map name=\"LYWER\"></map><map name=\"GDQMX\"></map><map name=\"QKMPV\"></map><map name=\"DIEJA\"></map><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i1/1025096528/O1CN01fDgbJq1y5s8fos10m_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i1/1025096528/O1CN010LWsTM1y5s8ikimcw_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i4/1025096528/O1CN01BVYEv61y5s8d4hMIG_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01RHi8861y5s8g8AQCJ_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01HpWXiv1y5s8hbpQAP_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i2/1025096528/O1CN01KOHgcf1y5s8e5TYUt_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i4/1025096528/O1CN010EtClM1y5s8iRCkdB_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i1/1025096528/O1CN01jrUiLm1y5sKZNvwea_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01GxoGxJ1y5sKXQVkuC_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i2/1025096528/O1CN01CMfzlg1y5sKR7w9bq_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i4/1025096528/O1CN01jIvX3m1y5sKXQVgkW_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01X7Cwdi1y5s8dR9avc_!!1025096528.jpg\"  /><img align=\"absmiddle\" src=\"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01qWIBPg1y5s8e5WAex_!!1025096528.jpg\"  /></p><img src=\"https://www.o0b.cn/i.php?t.png&rid=gw-3.65533c8ef12c5&p=1778788239&k=i_key&t=1699953810\" style=\"display:none\" />",		"item_imgs": [			{				"url": "//gd4.alicdn.com/imgextra/i3/1025096528/O1CN01Yyuaw31y5s8gjSr6D_!!1025096528-0-lubanu-s.jpg"			},			{				"url": "//gd1.alicdn.com/imgextra/i1/1025096528/O1CN01Pab3ZY1y5s8kJEXT7_!!1025096528-0-lubanu-s.jpg"			},			{				"url": "//gd2.alicdn.com/imgextra/i2/1025096528/O1CN011BBNpG1y5s8dPeGs2_!!1025096528-0-lubanu-s.jpg"			},			{				"url": "//gd1.alicdn.com/imgextra/i1/1025096528/O1CN01olDD7K1y5s8hdGqZz_!!1025096528-0-lubanu-s.jpg"			},			{				"url": "//gd3.alicdn.com/imgextra/i3/1025096528/O1CN01HlkbF11y5sEHPEl5N_!!1025096528.jpg"			}		],		"item_weight": "",		"post_fee": "0.00",		"freight": "",		"express_fee": "",		"ems_fee": "",		"shipping_to": "",		"video": {			"url": "http://cloud.video.taobao.com/play/u/p/1/e/6/t/1/428532568303.mp4"		},		"sample_id": "",		"props_name": "20509:9739281627:尺码:S码【月亮刺绣】;20509:9739281627:尺码:S码【月亮刺绣】;20509:9739281627:尺码:S码【月亮刺绣】;20509:9739281627:尺码:S码【月亮刺绣】;20509:9739281628:尺码:M码【月亮刺绣】;20509:9739281628:尺码:M码【月亮刺绣】;20509:9739281628:尺码:M码【月亮刺绣】;20509:9739281628:尺码:M码【月亮刺绣】;20509:9739281629:尺码:L码【月亮刺绣】;20509:9739281629:尺码:L码【月亮刺绣】;20509:9739281629:尺码:L码【月亮刺绣】;20509:9739281629:尺码:L码【月亮刺绣】;20509:9739281630:尺码:XL码【月亮刺绣】;20509:9739281630:尺码:XL码【月亮刺绣】;20509:9739281630:尺码:XL码【月亮刺绣】;20509:9739281630:尺码:XL码【月亮刺绣】;1627207:28341:颜色分类:黑色;1627207:3951856:颜色分类:奶白色;1627207:1101966612:颜色分类:雾霾蓝;1627207:11233070055:颜色分类:此链接为单衬衫,小物需另外加购;1627207:28341:颜色分类:黑色;1627207:3951856:颜色分类:奶白色;1627207:1101966612:颜色分类:雾霾蓝;1627207:11233070055:颜色分类:此链接为单衬衫,小物需另外加购;1627207:28341:颜色分类:黑色;1627207:3951856:颜色分类:奶白色;1627207:1101966612:颜色分类:雾霾蓝;1627207:11233070055:颜色分类:此链接为单衬衫,小物需另外加购;1627207:28341:颜色分类:黑色;1627207:3951856:颜色分类:奶白色;1627207:1101966612:颜色分类:雾霾蓝;1627207:11233070055:颜色分类:此链接为单衬衫,小物需另外加购",		"prop_imgs": {			"prop_img": []		},		"props_imgs": {			"prop_img": []		},		"property_alias": "",		"props": [			{				"name": "品牌",				"value": "other/其他"			},			{				"name": "尺码",				"value": "S码【月亮刺绣】 M码【月亮刺绣】 L码【月亮刺绣】 XL码【月亮刺绣】"			},			{				"name": "图案",				"value": "其他/other"			},			{				"name": "风格",				"value": "原创设计"			},			{				"name": "领型",				"value": "尖领"			},			{				"name": "颜色分类",				"value": "黑色 奶白色 雾霾蓝 此链接为单衬衫,小物需另外加购"			},			{				"name": "袖型",				"value": "常规"			},			{				"name": "袖长",				"value": "长袖"			},			{				"name": "衣长",				"value": "常规款"			},			{				"name": "服装版型",				"value": "直筒型"			},			{				"name": "材质成分",				"value": "聚丙烯纤维(丙纶)"			}		],		"total_sold": "-1",		"skus": {			"sku": [				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281627;1627207:28341",					"properties_name": "20509:9739281627:尺码:S码【月亮刺绣】;1627207:28341:颜色分类:黑色",					"quantity": 129,					"sku_id": "4626670918317"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281627;1627207:3951856",					"properties_name": "20509:9739281627:尺码:S码【月亮刺绣】;1627207:3951856:颜色分类:奶白色",					"quantity": 200,					"sku_id": "4619268527040"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281627;1627207:1101966612",					"properties_name": "20509:9739281627:尺码:S码【月亮刺绣】;1627207:1101966612:颜色分类:雾霾蓝",					"quantity": 37,					"sku_id": "4619268527048"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281627;1627207:11233070055",					"properties_name": "20509:9739281627:尺码:S码【月亮刺绣】;1627207:11233070055:颜色分类:此链接为单衬衫,小物需另外加购",					"quantity": 0,					"sku_id": "4517116248401"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281628;1627207:28341",					"properties_name": "20509:9739281628:尺码:M码【月亮刺绣】;1627207:28341:颜色分类:黑色",					"quantity": 115,					"sku_id": "4626670918318"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281628;1627207:3951856",					"properties_name": "20509:9739281628:尺码:M码【月亮刺绣】;1627207:3951856:颜色分类:奶白色",					"quantity": 200,					"sku_id": "4619268527041"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281628;1627207:1101966612",					"properties_name": "20509:9739281628:尺码:M码【月亮刺绣】;1627207:1101966612:颜色分类:雾霾蓝",					"quantity": 49,					"sku_id": "4619268527049"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281628;1627207:11233070055",					"properties_name": "20509:9739281628:尺码:M码【月亮刺绣】;1627207:11233070055:颜色分类:此链接为单衬衫,小物需另外加购",					"quantity": 0,					"sku_id": "4517116248402"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281629;1627207:28341",					"properties_name": "20509:9739281629:尺码:L码【月亮刺绣】;1627207:28341:颜色分类:黑色",					"quantity": 125,					"sku_id": "4626670918319"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281629;1627207:3951856",					"properties_name": "20509:9739281629:尺码:L码【月亮刺绣】;1627207:3951856:颜色分类:奶白色",					"quantity": 200,					"sku_id": "4619268527042"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281629;1627207:1101966612",					"properties_name": "20509:9739281629:尺码:L码【月亮刺绣】;1627207:1101966612:颜色分类:雾霾蓝",					"quantity": 11,					"sku_id": "4619268527050"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281629;1627207:11233070055",					"properties_name": "20509:9739281629:尺码:L码【月亮刺绣】;1627207:11233070055:颜色分类:此链接为单衬衫,小物需另外加购",					"quantity": 0,					"sku_id": "4517116248403"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281630;1627207:28341",					"properties_name": "20509:9739281630:尺码:XL码【月亮刺绣】;1627207:28341:颜色分类:黑色",					"quantity": 84,					"sku_id": "4626670918320"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281630;1627207:3951856",					"properties_name": "20509:9739281630:尺码:XL码【月亮刺绣】;1627207:3951856:颜色分类:奶白色",					"quantity": 200,					"sku_id": "4619268527043"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281630;1627207:1101966612",					"properties_name": "20509:9739281630:尺码:XL码【月亮刺绣】;1627207:1101966612:颜色分类:雾霾蓝",					"quantity": 94,					"sku_id": "4619268527051"				},				{					"price": 95,					"total_price": 0,					"orginal_price": 95,					"properties": "20509:9739281630;1627207:11233070055",					"properties_name": "20509:9739281630:尺码:XL码【月亮刺绣】;1627207:11233070055:颜色分类:此链接为单衬衫,小物需另外加购",					"quantity": 0,					"sku_id": "4517116248404"				}			]		},		"seller_id": "1025096528",		"sales": 0,		"shop_id": "100087465",		"props_list": {			"20509:9739281627": "尺码:S码【月亮刺绣】",			"20509:9739281628": "尺码:M码【月亮刺绣】",			"20509:9739281629": "尺码:L码【月亮刺绣】",			"20509:9739281630": "尺码:XL码【月亮刺绣】",			"1627207:28341": "颜色分类:黑色",			"1627207:3951856": "颜色分类:奶白色",			"1627207:1101966612": "颜色分类:雾霾蓝",			"1627207:11233070055": "颜色分类:此链接为单衬衫,小物需另外加购"		},		"seller_info": {			"nick": "wwj373347892",			"item_score": 4.86392,			"score_p": 4.90535,			"delivery_score": 4.90928,			"shop_type": "",			"user_num_id": "1025096528",			"sid": null,			"title": "",			"zhuy": "https://shop100087465",			"cert": "该店铺已通过金牌卖家认证",			"open_time": "8年老店",			"credit_score": "tb-rank-crown:2",			"shop_name": "神仙club"		},		"tmall": false,		"error": "",		"location": "浙江杭州",		"data_from": "Ha",		"has_discount": "false",		"is_promotion": "false",		"promo_type": null,		"props_img": [],		"format_check": "ok",		"desc_img": [			"http://img.alicdn.com/imgextra/i4/1025096528/O1CN01Bq49ve1y5s8ZsXDNh_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01bjn1GX1y5sD60AspK_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i4/1025096528/O1CN018qpdMZ1y5sE8bP7aR_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01D8AyeT1y5sE5H2dMr_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i1/1025096528/O1CN01W20sRZ1y5sE7sapTi_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i1/1025096528/O1CN01fDgbJq1y5s8fos10m_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i1/1025096528/O1CN010LWsTM1y5s8ikimcw_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i4/1025096528/O1CN01BVYEv61y5s8d4hMIG_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01RHi8861y5s8g8AQCJ_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01HpWXiv1y5s8hbpQAP_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i2/1025096528/O1CN01KOHgcf1y5s8e5TYUt_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i4/1025096528/O1CN010EtClM1y5s8iRCkdB_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i1/1025096528/O1CN01jrUiLm1y5sKZNvwea_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01GxoGxJ1y5sKXQVkuC_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i2/1025096528/O1CN01CMfzlg1y5sKR7w9bq_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i4/1025096528/O1CN01jIvX3m1y5sKXQVgkW_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01X7Cwdi1y5s8dR9avc_!!1025096528.jpg",			"http://img.alicdn.com/imgextra/i3/1025096528/O1CN01qWIBPg1y5s8e5WAex_!!1025096528.jpg"		],		"shop_item": [],		"relate_items": []	},
复制代码


用户头像

Geek_975207

关注

还未添加个人签名 2023-11-13 加入

还未添加个人简介

评论

发布
暂无评论
如何item_get-获得淘宝商品详情api接口_API 接口_Geek_975207_InfoQ写作社区