京东商品页面数据获取方法,京东 API 批量商品数据抓取示例

京东商城是一个网上购物平台,售卖各类商品,包括服装、鞋类、家居用品、美妆产品、电子产品等。要获取京东商品列表和商品详情页面数据,您可以通过开放平台的接口或者直接访问京东商城的网页来获取商品详情信息。以下是两种常用方法的介绍:

1. 通过京东开放平台接口获取商品列表和详情数据:

首先,您需要在开放平台注册成为开发者并创建一个应用,获取到所需的 App Key 和 App Secret 等信息。
使用获取到的 App Key 和 App Secret,进行签名和认证,获取 Access Token。
调用开放平台提供的接口,传入商品 ID 作为参数,获取对应商品的列表和详情页面数据。
请参考开放平台提供的接口文档,了解相应的接口和参数。

2. 直接访问京东商城网页并解析商品详情数据:

使用 HTTP 请求库,发送 GET 请求到京东商城的商品详情页面,将关键词作为参数传递给 URL。获取到返回的 HTML 页面,根据页面结构和 DOM 操作技术,解析出商品的详细信息,例如标题、价格、销量、库存、描述、图片等。
请注意,直接解析网页可能会受到页面结构和变动的影响,需要自行编写相关的解析逻辑。

以下是一个使用 Java 编写的示例代码,展示如何通过封装 API 获取商品列表数据:

JD.item_search - 获得关键词搜索京东商品列表数据返回值说明

{
	"items": {
		"url": "https://search.jd.com/Search?keyword=女装&spm=a.0.0&pvid=3b375194749e448e9dd6fea48db417dd&page=1",
		"keyword": "女装",
		"page": 1,
		"real_total_results": "685280",
		"total_results": "685280",
		"pagecount": 100,
		"products_total": "",
		"list_count": "",
		"page_size": "60",
		"item": [
			{
				"num_iid": "10060500255683",
				"detail_url": "https://item.jd.com/10060500255683.html",
				"title": "兹奈儿宽松羊毛衫女士软糯纯羊毛秋冬季上衣半高领打底衫毛衣针织衫女装米色M100-110斤",
				"pic_url": "//img13.360buyimg.com/n7/jfs/t1/57707/34/21955/129393/632054faEb952ea5d/2337e4974eba9bba.jpg",
				"price": "329.00",
				"promotion_price": "329.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "兹奈儿官方旗舰店"
			},
			{
				"num_iid": "10052272731071",
				"detail_url": "https://item.jd.com/10052272731071.html",
				"title": "爱心东东\t\n卡吉蘭娜(Kajilanna)新款连衣裙2023夏季女装收腰显瘦纱裙法式温柔风气质套装裙子夏天杏色上衣+咖色裙子M建议体重99-108斤",
				"pic_url": "//img11.360buyimg.com/n7/jfs/t1/87775/22/42010/46982/64a91d29F5e70cd50/01259f1789e681ef.jpg",
				"price": "89.00",
				"promotion_price": "89.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "卡吉蘭娜旗舰店"
			},
			{
				"num_iid": "10071068359043",
				"detail_url": "https://item.jd.com/10071068359043.html",
				"title": "欧若婷雅新款连衣裙女装2023夏季韩版时尚套装女显瘦高腰牛仔裙子女两件装套装M",
				"pic_url": "//img13.360buyimg.com/n7/jfs/t1/72960/40/22619/81122/641421c3F5254731f/0fc7dad0254cc0b6.jpg",
				"price": "128.00",
				"promotion_price": "128.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "欧若婷雅女装旗舰店"
			},
			{
				"num_iid": "10069243993139",
				"detail_url": "https://item.jd.com/10069243993139.html",
				"title": "LaChapelleSport拉夏贝尔短袖t恤女夏季透气纯棉运动休闲衣服女装时尚潮牌打底衫奶白色(守望麦田)L(推荐120-140斤)",
				"pic_url": "//img14.360buyimg.com/n7/jfs/t1/131901/27/34968/69654/64c5b88eFc10d1856/18c620af24f22a06.jpg",
				"price": "49.90",
				"promotion_price": "49.90",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "La Chapelle Sport服饰旗舰店"
			},
			{
				"num_iid": "10070237726183",
				"detail_url": "https://item.jd.com/10070237726183.html",
				"title": "红蜻蜓t恤女短袖2023年夏季新款女装修身打底格子百搭女士上衣服衫粉杏均码(适合80-130斤)",
				"pic_url": "//img13.360buyimg.com/n7/jfs/t1/180539/37/33110/159066/6406a82cF32522699/b61659e298ca064a.jpg",
				"price": "89.00",
				"promotion_price": "89.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "红蜻蜓女装旗舰店"
			},
			{
				"num_iid": "100057701712",
				"detail_url": "https://item.jd.com/100057701712.html",
				"title": "莫代尔阔腿裤女休闲高腰慵懒裤棉麻质感薄款甩甩裤杏色",
				"pic_url": "//img12.360buyimg.com/n7/jfs/t1/205517/29/31975/66821/64c9ab57F3abcef8e/fc57ae7567f673aa.jpg",
				"price": "79.90",
				"promotion_price": "79.90",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "莫代尔京东自营旗舰店"
			},
			{
				"num_iid": "10082745748306",
				"detail_url": "https://item.jd.com/10082745748306.html",
				"title": "粉蓝衣橱东方设计感拼色刺绣连衣裙女2023秋装名媛衬衫裙533L707墨染黑M",
				"pic_url": "//img11.360buyimg.com/n7/jfs/t1/177586/38/36589/77713/64d98c9bFecddd7d5/55c22b4b662ac5ab.jpg",
				"price": "1389.00",
				"promotion_price": "1389.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "粉蓝衣橱旗舰店"
			},
			{
				"num_iid": "100017802861",
				"detail_url": "https://item.jd.com/100017802861.html",
				"title": "HaloQueen短袖t恤女2023年夏季印花上衣韩版宽松bf风女学生HW1KD95",
				"pic_url": "//img11.360buyimg.com/n7/jfs/t1/89713/24/30813/130895/63934d92Ed274ffad/de056f42f163a685.jpg",
				"price": "69.00",
				"promotion_price": "69.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "Halo Queen服饰京东自营旗舰店"
			},
			{
				"num_iid": "100043605160",
				"detail_url": "https://item.jd.com/100043605160.html",
				"title": "森马(Semir)【疯狂动物城】短袖t恤女2023夏季时尚宽松上衣女109323100018",
				"pic_url": "//img10.360buyimg.com/n7/jfs/t1/131533/23/35867/113841/64d62da5F4a73c30d/dbfa69ef0fa3b5a2.jpg",
				"price": "79.99",
				"promotion_price": "79.99",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "森马京东自营旗舰店"
			},
			{
				"num_iid": "10073475233925",
				"detail_url": "https://item.jd.com/10073475233925.html",
				"title": "亿梵莎(YIFANSHA)新款连衣裙夏季女生裙子夏天2023法式高级感气质显瘦仙女中长裙米白色均码",
				"pic_url": "//img10.360buyimg.com/n7/jfs/t1/1947/8/21150/36116/643e5ca8F4d425857/c0506c79d52d48dd.jpg",
				"price": "98.00",
				"promotion_price": "98.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "亿梵莎旗舰店"
			},
			{
				"num_iid": "10068400224024",
				"detail_url": "https://item.jd.com/10068400224024.html",
				"title": "UR明星同款2023夏季新款欧美棋盘格牛仔连衣裙UWV832064蓝色格子M",
				"pic_url": "//img14.360buyimg.com/n7/jfs/t1/126018/20/32030/110863/6426db0bFf09ac5df/5177f9e44f433385.jpg",
				"price": "139.00",
				"promotion_price": "139.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "UR官方旗舰店"
			},
			{
				"num_iid": "10073500742953",
				"detail_url": "https://item.jd.com/10073500742953.html",
				"title": "妍莉芬(yanlifen)连衣裙女2023夏季新款法式气质设计感小众到及脚踝长裙子夏天蓝色M体重108-125",
				"pic_url": "//img13.360buyimg.com/n7/jfs/t1/6845/38/18520/118147/643ea627F40a0cbe5/8c24678bb5ad5273.jpg",
				"price": "128.00",
				"promotion_price": "128.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "妍莉芬服饰旗舰店"
			},
			{
				"num_iid": "10082746005118",
				"detail_url": "https://item.jd.com/10082746005118.html",
				"title": "粉蓝衣橱东方韵味艺术晕染连衣裙女2023秋装新款系带收腰长袖裙子533L702香草杏S",
				"pic_url": "//img13.360buyimg.com/n7/jfs/t1/108410/3/43134/103614/64d98c9fFa912b34a/b9522ca96b362f0f.jpg",
				"price": "1439.00",
				"promotion_price": "1439.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "粉蓝衣橱旗舰店"
			},
			{
				"num_iid": "100049328466",
				"detail_url": "https://item.jd.com/100049328466.html",
				"title": "尚都比拉气质温柔V领珍珠排扣短袖t恤女夏季显瘦小众设计感上衣杏色L",
				"pic_url": "//img11.360buyimg.com/n7/jfs/t1/102317/6/23857/69736/646cc3b0F38994947/f85e5b10d577da0c.jpg",
				"price": "99.00",
				"promotion_price": "99.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "尚都比拉京东自营旗舰店"
			},
			{
				"num_iid": "100048780064",
				"detail_url": "https://item.jd.com/100048780064.html",
				"title": "HaloQueenPolo领连衣裙女夏款中长款收腰显瘦初恋短袖A字裙夏H134Q1604",
				"pic_url": "//img14.360buyimg.com/n7/jfs/t1/123226/38/34603/170777/64b4f657Fd76dcb25/bb3831ec858e66b2.jpg",
				"price": "139.00",
				"promotion_price": "139.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "Halo Queen服饰京东自营旗舰店"
			},
			{
				"num_iid": "100056174983",
				"detail_url": "https://item.jd.com/100056174983.html",
				"title": "真维斯(JEANSWEST)针织衫女夏季薄款圆领宽松打底衫设计感时尚休闲上衣女藏青色均码",
				"pic_url": "//img13.360buyimg.com/n7/jfs/t1/179386/39/34966/84708/64be8a57F3fbc809b/bae17855fbef71ef.jpg",
				"price": "89.00",
				"promotion_price": "89.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "真维斯女装京东自营旗舰店"
			},
			{
				"num_iid": "100045387838",
				"detail_url": "https://item.jd.com/100045387838.html",
				"title": "HaloQueen短袖t恤女夏款娃娃领宽松休闲上衣女H132T1437",
				"pic_url": "//img13.360buyimg.com/n7/jfs/t1/127672/2/33412/82119/64798f25F180385c5/9e6c0c81c8f21284.jpg",
				"price": "69.00",
				"promotion_price": "69.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "Halo Queen服饰京东自营旗舰店"
			},
			{
				"num_iid": "10073476573495",
				"detail_url": "https://item.jd.com/10073476573495.html",
				"title": "亿梵莎(YIFANSHA)新款连衣裙夏季女生裙子夏天学生衣服2023法式碎花收腰显瘦中长裙图片色均码",
				"pic_url": "//img10.360buyimg.com/n7/jfs/t1/181273/39/34688/121668/643e5f79Fc887a404/596acfcd92b0f701.jpg",
				"price": "88.00",
				"promotion_price": "88.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "亿梵莎旗舰店"
			},
			{
				"num_iid": "10068036253998",
				"detail_url": "https://item.jd.com/10068036253998.html",
				"title": "兹奈儿春装女士春秋薄款圆领卫衣女新款2023洋气春季学生外套女LJ2322浅咖色M",
				"pic_url": "//img13.360buyimg.com/n7/jfs/t1/126251/5/33369/100467/63d54cc5Fe4657579/2648ee816e7ace53.jpg",
				"price": "169.00",
				"promotion_price": "169.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "兹奈儿官方旗舰店"
			},
			{
				"num_iid": "10077522009044",
				"detail_url": "https://item.jd.com/10077522009044.html",
				"title": "妖精的口袋法式方领连衣裙女2023夏新款森系A字公主长裙水果粉色S",
				"pic_url": "//img14.360buyimg.com/n7/jfs/t1/171750/20/39096/73242/64dba396Fc37cf671/339677593836b46f.jpg",
				"price": "387.00",
				"promotion_price": "387.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "妖精的口袋旗舰店"
			},
			{
				"num_iid": "10073540561927",
				"detail_url": "https://item.jd.com/10073540561927.html",
				"title": "太平鸟2023年夏季新款法式撞色系带连衣裙长袖印花裙女黑色纹样L",
				"pic_url": "//img12.360buyimg.com/n7/jfs/t1/220946/6/33345/60723/64d7db7dF9c96e550/cfdcee05803a00ec.jpg",
				"price": "398.00",
				"promotion_price": "398.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "太平鸟官方旗舰店"
			},
			{
				"num_iid": "100010966680",
				"detail_url": "https://item.jd.com/100010966680.html",
				"title": "俞兆林女装韩版时尚T恤夏季宽松印花短袖T恤女YWTC19Q347",
				"pic_url": "//img10.360buyimg.com/n7/jfs/t1/180047/23/34620/108011/64b0bc2aF4dafd52c/fff0e606affe2f1f.jpg",
				"price": "69.00",
				"promotion_price": "69.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "俞兆林女服京东自营旗舰店"
			},
			{
				"num_iid": "100054800857",
				"detail_url": "https://item.jd.com/100054800857.html",
				"title": "尚都比拉米杏色休闲裤女春季遮肉显瘦直筒裤高腰短裤子米杏色XL",
				"pic_url": "//img12.360buyimg.com/n7/jfs/t1/111646/7/35330/30361/646ccf49F81ca986a/1926c51bceb5036e.jpg",
				"price": "159.00",
				"promotion_price": "159.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "尚都比拉京东自营旗舰店"
			},
			{
				"num_iid": "100057331975",
				"detail_url": "https://item.jd.com/100057331975.html",
				"title": "唐狮(TonLion)2023圆领小众半袖上衣白色内搭本白L",
				"pic_url": "//img10.360buyimg.com/n7/jfs/t1/200818/15/23325/118750/647e8b49F53aaa2ef/e2ae00fd08bf4917.jpg",
				"price": "48.50",
				"promotion_price": "48.50",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "唐狮(TonLion)京东自营旗舰店"
			},
			{
				"num_iid": "10082745774501",
				"detail_url": "https://item.jd.com/10082745774501.html",
				"title": "粉蓝衣橱【醋酸缎面礼服】东方感重工绣花连衣裙女2023秋装礼服裙533L759映海蓝M",
				"pic_url": "//img11.360buyimg.com/n7/jfs/t1/180274/33/35766/86556/64d98c9fF91853d05/e46a38de1aebc926.jpg",
				"price": "1239.00",
				"promotion_price": "1239.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "粉蓝衣橱旗舰店"
			},
			{
				"num_iid": "100053557445",
				"detail_url": "https://item.jd.com/100053557445.html",
				"title": "品彩花色方领短袖连衣裙女套头高腰通勤纯色中长a字裙P132Q1382",
				"pic_url": "//img10.360buyimg.com/n7/jfs/t1/121929/38/30967/195909/6401e78dF14b28cdb/1f7245308badf3e8.jpg",
				"price": "199.00",
				"promotion_price": "199.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "品彩(PinCai)服饰京东自营旗舰店"
			},
			{
				"num_iid": "100011540565",
				"detail_url": "https://item.jd.com/100011540565.html",
				"title": "森马短袖t恤女纯色短款上衣基础圆领夏季纯棉打底衫109321100020",
				"pic_url": "//img10.360buyimg.com/n7/jfs/t1/167886/9/38251/102180/64d6209fFdc24a3ff/f6e8c6cd9e07fa47.jpg",
				"price": "49.00",
				"promotion_price": "49.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "森马京东自营旗舰店"
			},
			{
				"num_iid": "100052572529",
				"detail_url": "https://item.jd.com/100052572529.html",
				"title": "森马连衣裙女2023夏修身显瘦撞色字母学院风针织裙复古风109323114025",
				"pic_url": "//img14.360buyimg.com/n7/jfs/t1/175728/21/38155/140785/64d6071eF6b0eba5b/fa9a557833a25d87.jpg",
				"price": "139.99",
				"promotion_price": "139.99",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "森马京东自营旗舰店"
			},
			{
				"num_iid": "100053825983",
				"detail_url": "https://item.jd.com/100053825983.html",
				"title": "尚都比拉时髦设计感弧形V领造型拼接网纱双层灯笼袖显瘦t恤女黑色XL",
				"pic_url": "//img13.360buyimg.com/n7/jfs/t1/171067/34/35170/63794/6401ce50Ffb3ddf01/59058ff52f50d910.jpg",
				"price": "99.00",
				"promotion_price": "99.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "尚都比拉京东自营旗舰店"
			},
			{
				"num_iid": "100051485012",
				"detail_url": "https://item.jd.com/100051485012.html",
				"title": "太平鸟立体刺绣短袖T恤宽松洋气体恤女米白M",
				"pic_url": "//img12.360buyimg.com/n7/jfs/t1/215219/23/33701/59437/649bdbacF5099f164/8baaca63e9eac174.jpg",
				"price": "120.00",
				"promotion_price": "120.00",
				"sales": 0,
				"sample_id": "",
				"post_fee": "",
				"seller": "太平鸟京东自营旗舰店"
			}

你可能感兴趣的:(电商api数据,python)