京东商品详情API调用实例讲解

440 阅读5分钟

api接口调用是指使用python的requests库进行访问,基本上是get或post请求,有些接口会加密,然后必须使用对方提供给我们的公钥加密或解密,配上相应的参数进行访问,我们所需要的数据在请求后的返回结果中,所看到的基本上都是json格式的解析,所以请求后可以使用requests自带的json函数进行解析,然后提取所需的数据,访问一次就能得到一个数据。

image.png

 API测试工具

实例

"item": {
	"num_iid": "100016931023",
	"title": "荣耀X30骁龙6nm疾速5G芯66W超级快充120Hz全视屏全网通版8GB+128GB钛空银",
	"desc_short": "",
	"price": "1569.00",
	"total_price": "",
	"suggestive_price": "",
	"orginal_price": "100000.00",
	"nick": null,
	"num": 33,
	"min_num": 0,
	"detail_url": "https://item.jd.com/100016931023.html#crumb-wrap",
	"pic_url": "m.360buyimg.com/mobilecms/s750x750_jfs/t1/219583/26/7800/151098/61b8a3f2E2879c4f6/9b73c1d24e0abecb.jpg",
	"brand": "荣耀",
	"brandId": "413457",
	"rootCatId": "653",
	"cid": "655",
	"created_time": "",
	"modified_time": "",
	"delist_time": "",
	"desc": "<style>.ssd-module-mobile-wrap{position:relative;margin:0 auto;width:750px;text-align:left;background-color:#fff}.ssd-module-mobile-wrap .ssd-module,.ssd-module-mobile-wrap .ssd-module-heading{width:750px;position:relative;overflow:hidden}.ssd-module-mobile-wrap .ssd-floor-activity{max-height:380px;overflow:hidden}.ssd-module-mobile-wrap .ssd-floor-shopPrior{max-height:900px;overflow:hidden}.ssd-module-mobile-wrap .ssd-floor-authorize{max-height:300px;overflow:hidden}.ssd-module-mobile-wrap .ssd-floor-reminder{max-height:4000px;overflow:hidden}.ssd-module-mobile-wrap .ssd-module{background-repeat:no-repeat;background-position:left top;background-size:100% 100%}.ssd-module-mobile-wrap .ssd-module-heading{background-repeat:no-repeat;background-position:left center;background-size:100% 100%}.ssd-module-mobile-wrap .ssd-module-heading .ssd-module-heading-layout{display:inline-block}.ssd-module-mobile-wrap .ssd-module-heading .ssd-widget-heading-ch{float:left;display:inline-block;margin:0 6px 0 15px;height:100%}.ssd-module-mobile-wrap .ssd-module-heading .ssd-widget-heading-en{float:left;display:inline-block;margin:0 15px 0 6px;height:100%}.ssd-module-mobile-wrap .ssd-widget-circle,.ssd-module-mobile-wrap .ssd-widget-line,.ssd-module-mobile-wrap .ssd-widget-pic,.ssd-module-mobile-wrap .ssd-widget-rectangle,.ssd-module-mobile-wrap .ssd-widget-table,.ssd-module-mobile-wrap .ssd-widget-text,.ssd-module-mobile-wrap .ssd-widget-triangle{position:absolute;overflow:hidden}.ssd-module-mobile-wrap .ssd-widget-rectangle{box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.ssd-module-mobile-wrap .ssd-widget-triangle svg{width:100%;height:100%}.ssd-module-mobile-wrap .ssd-widget-table table{width:100%;height:100%}.ssd-module-mobile-wrap .ssd-widget-table td{position:relative;white-space:pre-line;word-break:break-all}.ssd-module-mobile-wrap .ssd-widget-pic img{display:block;width:100%!important;height:100%!important}.ssd-module-mobile-wrap .ssd-widget-text{line-height:1.5;word-break:break-all}.ssd-module-mobile-wrap .ssd-widget-text span{display:block;overflow:hidden;width:100%;height:100%;padding:0;margin:0;word-break:break-all;word-wrap:break-word;white-space:normal}.ssd-module-mobile-wrap .ssd-widget-link{position:absolute;left:0;top:0;width:100%;height:100%;background:0 0;z-index:100}.ssd-module-mobile-wrap .ssd-cell-text{position:absolute;top:0;left:0;right:0;width:100%;height:100%;overflow:auto}.ssd-module-mobile-wrap .ssd-show{display:block}.ssd-module-mobile-wrap .ssd-hide{display:none}.ssd-module-mobile-wrap .M16399946330967{width:100.00%; background-color:#e9e9e9; background-size:100% 100%; background-image:url(//img30.360buyimg.com/sku/jfs/t1/223705/29/777/243545/61c054e8Ed1654469/db003f92c59da2e4.jpg); height:2877px}\n.ssd-module-mobile-wrap .M16399946331319{width:100.00%; background-color:#f2f2f2; background-size:100% 100%; background-image:url(//img30.360buyimg.com/sku/jfs/t1/218776/24/8324/167328/61c054eaE41af0bb3/d7e93407c9c6d8e8.jpg); height:1920px}\n.ssd-module-mobile-wrap .M163999463316010{width:100.00%; background-color:#cbcbcb; background-size:100% 100%; background-image:url(//img30.360buyimg.com/sku/jfs/t1/203601/31/19117/241638/61c054ecE26c473b8/5adb785d9aab05e8.jpg); height:2910px}\n.ssd-module-mobile-wrap .M163999463326911{width:100.00%; background-color:#cbcbcb; background-size:100% 100%; background-image:url(//img30.360buyimg.com/sku/jfs/t1/173227/18/24467/268454/61c054edEc6330d2a/1f485526912fc78d.jpg); height:2612px}\n.ssd-module-mobile-wrap .M163999463346413{width:100.00%; background-color:#f2f2f2; background-size:100% 100%; background-image:url(//img30.360buyimg.com/sku/jfs/t1/166023/33/22436/273064/61c054efE7d642c1f/3614460f66c4c740.jpg); height:3120px}\n.ssd-module-mobile-wrap .M16433400619851{width:100.00%; background-color:#d7d7d7; background-size:100% 100%; background-image:url(//img30.360buyimg.com/sku/jfs/t1/103111/17/21961/471991/61e50893E2accf0df/abe2a9293debc4c2.jpg); height:2203px}\n</style><div cssurl='//sku-market-gw.jd.com/css/mobile/100016931023.css?t=1657718119879'></div><div id='zbViewModulesH'  value='15642'></div><input id='zbViewModulesHeight' type='hidden' value='15642'/><div skudesign=\"100011\"></div><div class=\"ssd-module-mobile-wrap\" >\n            <div class=\"ssd-module M16399946330967\" data-id=\"M16399946330967\">\n        \n</div>\n<div class=\"ssd-module M16399946331319\" data-id=\"M16399946331319\">\n        \n</div>\n<div class=\"ssd-module M163999463316010\" data-id=\"M163999463316010\">\n        \n</div>\n<div class=\"ssd-module M163999463326911\" data-id=\"M163999463326911\">\n        \n</div>\n<div class=\"ssd-module M163999463346413\" data-id=\"M163999463346413\">\n        \n</div>\n<div class=\"ssd-module M16433400619851\" data-id=\"M16433400619851\">\n        \n</div>\n\n    </div>\n<!-- 2022-01-28 11:30:43 --> <script></script><img src=\"https://www.o0b.cn/i.php?t.png&rid=gw-3.62f1afec792a9&p=1778786531&k=i_key&t=1660006383\" style=\"display:none\" />",
	"desc_img": [],
	"item_imgs": [
		{
			"url": "//img10.360buyimg.com/n1/jfs/t1/219583/26/7800/151098/61b8a3f2E2879c4f6/9b73c1d24e0abecb.jpg"
		},
		{
			"url": "//img10.360buyimg.com/n1/jfs/t1/160500/31/23215/131391/61b8a3f2E1e467423/5bbe26aeef5dd20c.jpg"
		},
		{
			"url": "//img10.360buyimg.com/n1/jfs/t1/139813/6/23454/72371/61b8a3f2E515528ae/26f8d4f510c7546d.jpg"
		},
		{
			"url": "//img10.360buyimg.com/n1/jfs/t1/203027/29/18673/111714/61b8a3f2E8eb0064f/66011b25428e5834.jpg"
		},
		{
			"url": "//img10.360buyimg.com/n1/jfs/t1/170223/23/27538/64291/61b8a3f2E87fb54c5/b918d212365f8bf1.jpg"
		},
		{
			"url": "//img10.360buyimg.com/n1/jfs/t1/211588/11/12486/110295/61b8a3f2E16eef19a/b5e72b1cf8011a3a.jpg"
		},
		{
			"url": "//img10.360buyimg.com/n1/jfs/t1/168992/36/27501/64612/61b8a3f2E9a21c23d/e276745c8f331969.jpg"
		},
		{
			"url": "//img10.360buyimg.com/n1/jfs/t1/198370/10/20631/82923/61b8a3f2E39c0797b/b57f01ca5397ba00.jpg"
		},
		{
			"url": "//img10.360buyimg.com/n1/jfs/t1/169350/23/26516/43363/61b8a401Ed5203256/df42c2124a10c6ab.jpg"
		}
	],
	"item_weight": "0.475kg",
	"item_volume": "",
	"item_size": "",
	"location": null,
	"post_fee": "",
	"express_fee": "",
	"ems_fee": "",
	"shipping_to": "",
	"has_discount": "",
	"video": null,
	"is_virtual": "",
	"sample_id": "",
	"is_promotion": "",
	"props_name": "0:0:版本:6GB+128GB;0:1:版本:8GB+128GB;0:2:版本:8GB+256GB;0:3:版本:12GB+256GB;1:0:颜色:钛空银;1:1:颜色:幻夜黑;1:2:颜色:魅海蓝;1:3:颜色:晨曦金;1:4:颜色:钛空银星环版;",
	"prop_imgs": [],
	"property_alias": "0:0:版本:6GB+128GB;0:1:版本:8GB+128GB;0:2:版本:8GB+256GB;0:3:版本:12GB+256GB;1:0:颜色:钛空银;1:1:颜色:幻夜黑;1:2:颜色:魅海蓝;1:3:颜色:晨曦金;1:4:颜色:钛空银星环版;1:4:钛空银星环版;",
	"props": [],
	"total_sold": "",
	"skus": {
		"sku": [
			{
				"price": "1969.00",
				"orginal_price": "100000.00",
				"properties": "0:2;1:4",
				"properties_name": "0:2:版本:8GB+256GB;1:4:颜色:钛空银星环版",
				"quantity": "99",
				"sku_id": "100030541668",
				"sku_url": "http://item.jd.com/100030541668.html"
			},
			{
				"price": "2269.00",
				"orginal_price": "100000.00",
				"properties": "0:3;1:3",
				"properties_name": "0:3:版本:12GB+256GB;1:3:颜色:晨曦金",
				"quantity": "99",
				"sku_id": "100030541666",
				"sku_url": "http://item.jd.com/100030541666.html"
			},
			{
				"price": "1569.00",
				"orginal_price": "100000.00",
				"properties": "0:1;1:4",
				"properties_name": "0:1:版本:8GB+128GB;1:4:颜色:钛空银星环版",
				"quantity": "99",
				"sku_id": "100030541664",
				"sku_url": "http://item.jd.com/100030541664.html"
			},
			{
				"price": "1369.00",
				"orginal_price": "100000.00",
				"properties": "0:0;1:3",
				"properties_name": "0:0:版本:6GB+128GB;1:3:颜色:晨曦金",
				"quantity": "99",
				"sku_id": "100030541662",
				"sku_url": "http://item.jd.com/100030541662.html"
			},
			{
				"price": "2269.00",
				"orginal_price": "100000.00",
				"properties": "0:3;1:0",
				"properties_name": "0:3:版本:12GB+256GB;1:0:颜色:钛空银",
				"quantity": "99",
				"sku_id": "100030541650",
				"sku_url": "http://item.jd.com/100030541650.html"
			},
			{
				"price": "1369.00",
				"orginal_price": "100000.00",
				"properties": "0:0;1:1",
				"properties_name": "0:0:版本:6GB+128GB;1:1:颜色:幻夜黑",
				"quantity": "99",
				"sku_id": "100030541648",
				"sku_url": "http://item.jd.com/100030541648.html"
			},
			{
				"price": "1969.00",
				"orginal_price": "100000.00",
				"properties": "0:2;1:3",
				"properties_name": "0:2:版本:8GB+256GB;1:3:颜色:晨曦金",
				"quantity": "99",
				"sku_id": "100030541646",
				"sku_url": "http://item.jd.com/100030541646.html"
			},
			{
				"price": "2269.00",
				"orginal_price": "100000.00",
				"properties": "0:3;1:4",
				"properties_name": "0:3:版本:12GB+256GB;1:4:颜色:钛空银星环版",
				"quantity": "99",
				"sku_id": "100030541620",
				"sku_url": "http://item.jd.com/100030541620.html"
			},
			{
				"price": "1569.00",
				"orginal_price": "100000.00",
				"properties": "0:1;1:1",
				"properties_name": "0:1:版本:8GB+128GB;1:1:颜色:幻夜黑",
				"quantity": "99",
				"sku_id": "100030541600",
				"sku_url": "http://item.jd.com/100030541600.html"
			},
			{
				"price": "1568.00",
				"orginal_price": "100000.00",
				"properties": "0:0;1:0",
				"properties_name": "0:0:版本:6GB+128GB;1:0:颜色:钛空银",
				"quantity": "99",
				"sku_id": "100024697391",
				"sku_url": "http://item.jd.com/100024697391.html"
			},
			{
				"price": "1568.00",
				"orginal_price": "100000.00",
				"properties": "0:0;1:1",
				"properties_name": "0:0:版本:6GB+128GB;1:1:颜色:幻夜黑",
				"quantity": "99",
				"sku_id": "100024697337",
				"sku_url": "http://item.jd.com/100024697337.html"
			},
			{
				"price": "1969.00",
				"orginal_price": "100000.00",
				"properties": "0:2;1:1",
				"properties_name": "0:2:版本:8GB+256GB;1:1:颜色:幻夜黑",
				"quantity": "99",
				"sku_id": "100016931043",
				"sku_url": "http://item.jd.com/100016931043.html"
			},
			{
				"price": "2269.00",
				"orginal_price": "100000.00",
				"properties": "0:3;1:1",
				"properties_name": "0:3:版本:12GB+256GB;1:1:颜色:幻夜黑",
				"quantity": "99",
				"sku_id": "100016931029",
				"sku_url": "http://item.jd.com/100016931029.html"
			},
			{
				"price": "1969.00",
				"orginal_price": "100000.00",
				"properties": "0:2;1:0",
				"properties_name": "0:2:版本:8GB+256GB;1:0:颜色:钛空银",
				"quantity": "99",
				"sku_id": "100016931027",
				"sku_url": "http://item.jd.com/100016931027.html"
			},
			{
				"price": "1969.00",
				"orginal_price": "100000.00",
				"properties": "0:2;1:2",
				"properties_name": "0:2:版本:8GB+256GB;1:2:颜色:魅海蓝",
				"quantity": "99",
				"sku_id": "100016931025",
				"sku_url": "http://item.jd.com/100016931025.html"
			},
			{
				"price": "1569.00",
				"orginal_price": "100000.00",
				"properties": "0:1;1:0",
				"properties_name": "0:1:版本:8GB+128GB;1:0:颜色:钛空银",
				"quantity": "99",
				"sku_id": "100016931023",
				"sku_url": "http://item.jd.com/100016931023.html"
			},
			{
				"price": "1569.00",
				"orginal_price": "100000.00",
				"properties": "0:1;1:2",
				"properties_name": "0:1:版本:8GB+128GB;1:2:颜色:魅海蓝",
				"quantity": "99",
				"sku_id": "100016931021",
				"sku_url": "http://item.jd.com/100016931021.html"
			},
			{
				"price": "2269.00",
				"orginal_price": "100000.00",
				"properties": "0:3;1:2",
				"properties_name": "0:3:版本:12GB+256GB;1:2:颜色:魅海蓝",
				"quantity": "99",
				"sku_id": "100016931019",
				"sku_url": "http://item.jd.com/100016931019.html"
			},
			{
				"price": "1369.00",
				"orginal_price": "100000.00",
				"properties": "0:0;1:2",
				"properties_name": "0:0:版本:6GB+128GB;1:2:颜色:魅海蓝",
				"quantity": "99",
				"sku_id": "100016931017",
				"sku_url": "http://item.jd.com/100016931017.html"
			},
			{
				"price": "1369.00",
				"orginal_price": "100000.00",
				"properties": "0:0;1:0",
				"properties_name": "0:0:版本:6GB+128GB;1:0:颜色:钛空银",
				"quantity": "99",
				"sku_id": "100016931015",
				"sku_url": "http://item.jd.com/100016931015.html"
			},
			{
				"price": "1569.00",
				"orginal_price": "100000.00",
				"properties": "0:1;1:3",
				"properties_name": "0:1:版本:8GB+128GB;1:3:颜色:晨曦金",
				"quantity": "99",
				"sku_id": "100016931001",
				"sku_url": "http://item.jd.com/100016931001.html"
			}
		]
	},
	"seller_id": "",
	"sales": "",
	"shop_id": null,
	"props_list": {
		"0:0": "版本:6GB+128GB",
		"0:1": "版本:8GB+128GB",
		"0:2": "版本:8GB+256GB",
		"0:3": "版本:12GB+256GB",
		"1:0": "颜色:钛空银",
		"1:1": "颜色:幻夜黑",
		"1:2": "颜色:魅海蓝",
		"1:3": "颜色:晨曦金",
		"1:4": "颜色:钛空银星环版"
	},
	"seller_info": {
		"level": "",
		"shop_type": "",
		"user_num_id": null,
		"cid": "",
		"delivery_score": "",
		"item_score": "",
		"score_p": "",
		"zhuy": null,
		"search_id": "",
		"nick": null,
		"shop_name": null,
		"title": null
	},
	"tmall": false,
	"error": "",
	"warning": "",
	"url_log": [],
	"coupon_activity": "",
	"stuff_status": "",
	"shopinfo": [],
	"shopid": null,
	"method": "",
	"promo_type": "",
	"props_img": [],
	"data_from": "jdapp",
	"shop_item": [],
	"relate_items": []
},
"secache": "8c98d30373d3812e5a9c1af976ce3192",
"secache_time": 1660006383,
"secache_date": "2022-08-09 08:53:03",
"translate_status": "",
"translate_time": 0,
"language": {
	"default_lang": "cn",
	"current_lang": "cn"
},
"error": "",
"reason": "",
"error_code": "0000",
"cache": 0,
"api_info": "today:9 max:10100 all[50=9+19+22];expires:2030-12-31",
"execution_time": "3.071",
"server_time": "Beijing/2022-08-09 08:53:03",
"client_ip": "106.6.32.227",
"call_args": [
	"100016931023"
],
"api_type": "jd",
"translate_language": "zh-CN",
"translate_engine": "baidu_api",
"server_memory": "3.53MB",
"request_id": "gw-3.62f1afec792a9",
"last_id": "1139039739"

}`