探秘 jd.item_search_img:京东按图搜索商品 API 返回值全攻略
- 2024-05-14 江西
本文字数:5063 字
阅读完需:约 17 分钟
京东(JD.com)并没有公开一个名为 jd.item_search_img
的按图搜索商品 API,因为它可能是一个内部 API 或者是一个第三方开发者可能使用的非官方接口。不过,我们可以基于通常的 API 设计和功能来探讨一下如何理解和处理类似的按图搜索商品 API 的返回值。
处理 API 返回值
检查状态码:首先,检查
status
字段以确定请求是否成功。如果状态码是error
,则查看message
字段以获取错误信息。解析数据:如果请求成功,遍历
data
数组中的每个元素以获取商品信息。每个元素可能包含商品 ID、名称、图片 URL、价格等字段。处理图像匹配得分:如果 API 返回了图像匹配得分(如示例中的
score
字段),则可以使用该得分对搜索结果进行排序或过滤。较高的得分通常表示图像与搜索查询更匹配。处理分页信息:如果 API 支持分页(如示例中的
page
和pageSize
字段),则可以使用这些信息来请求更多页的结果。错误处理:确保你的代码能够妥善处理任何可能的错误情况,如网络错误、无效的输入或 API 的特定错误代码。
缓存和性能优化:考虑使用缓存来存储经常查询的结果,以减少对 API 的调用次数并提高性能。此外,还可以优化你的代码以减少不必要的网络请求和数据处理。
遵守使用条款和限制:如果你使用的是第三方提供的非官方 API,请确保遵守其使用条款和限制。不要过度请求或滥用 API,以免对你的应用或账户造成不利影响。
jd.item_search_img
公共参数
请求地址: https://api-gw.onebound.cn/jd/item_search_img
请求参数
请求参数:imgid=https://img13.360buyimg.com/n1/jfs/t1/227724/13/10901/137957/658ce427F3fa0fecd/e310c1eae499d322.jpg
参数说明:imgid:图片 id(京东格式),也支持图片 url 或 BASE64 格式的图片上传
响应参数
Version: Date:
"items": {
"item": [
{
"title": "【母亲节送妈妈礼物 520情人节送女友】兰蔻兰蔻菁纯臻颜淡纹眼霜",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/176467/30/43165/63450/65f11ff1F056cbcfa/73ae221fd1c9af02.jpg.dpg",
"price": "699",
"promotion_price": "699",
"sales": 470,
"num_iid": "100101981730",
"shop_id": "1000482215",
"cid": "1381",
"similarity": "0.982646465",
"detail_url": "https://item.jd.com/100101981730.html"
},
{
"title": "金属眼霜面霜专用挖勺小号分装勺耐用卫生化妆品导入勺子美容工具 1个 金属挖勺(配收纳盒)",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/50008/20/23114/69886/64001103F791dc0c7/4088e015d3c03007.jpg.dpg",
"price": "6.9",
"promotion_price": "6.9",
"sales": 24,
"num_iid": "10069918697286",
"shop_id": "12474517",
"cid": "16832",
"similarity": "0.828529119",
"detail_url": "https://item.jd.com/10069918697286.html"
},
{
"title": "兰蔻(LANCOME)菁纯眼霜20ml 淡化细纹滋润保湿护肤 生日礼物送女友 母亲节礼物",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/224993/11/10419/141349/65952b7dF326eff4d/62de13a2e526aa80.jpg.dpg",
"price": "659",
"promotion_price": "659",
"sales": 677,
"num_iid": "100081757735",
"shop_id": "1000362843",
"cid": "1381",
"similarity": "0.930544913",
"detail_url": "https://item.jd.com/100081757735.html"
},
{
"title": "兰蔻(LANCOME)菁纯眼霜20ml 淡化细纹滋润保湿 护肤品节日生日礼物送女友老婆",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/124139/21/41429/96553/65a74e39Fad6ef717/3684d96320d94b47.jpg.dpg",
"price": "659",
"promotion_price": "659",
"sales": 23904,
"num_iid": "100089787904",
"shop_id": "1000470962",
"cid": "1381",
"similarity": "0.92507571",
"detail_url": "https://item.jd.com/100089787904.html"
},
{
"title": "兰蔻(LANCOME)菁纯臻颜淡纹眼霜3ml*3 旅行装",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/147926/7/42625/89482/65eff9d4F61af0f37/929b59f78e0f1f50.jpg.dpg",
"price": "159.9",
"promotion_price": "159.9",
"sales": 322,
"num_iid": "100064608018",
"shop_id": "1000376954",
"cid": "1381",
"similarity": "0.915060401",
"detail_url": "https://item.jd.com/100064608018.html"
},
{
"title": "兰蔻菁纯臻颜精萃乳霜(轻盈)15ml 旅行装",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/225902/32/11571/36719/659f865dFcfee8ff6/b33345cab32dace4.jpg.dpg",
"price": "199",
"promotion_price": "199",
"sales": 2382,
"num_iid": "100083062709",
"shop_id": "1000343263",
"cid": "1381",
"similarity": "0.866021454",
"detail_url": "https://item.jd.com/100083062709.html"
},
{
"title": "兰蔻(LANCOME)菁纯眼霜臻颜焕亮淡化黑眼圈细纹紧致抗皱老20ml 20ml",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/201888/18/33014/23096/65d72c71Fce3a412e/0a46dc88a5915daf.jpg.dpg",
"price": "658",
"promotion_price": "658",
"sales": 16,
"num_iid": "10096765748433",
"shop_id": "13023911",
"cid": "1381",
"similarity": "0.903626025",
"detail_url": "https://item.jd.com/10096765748433.html"
},
{
"title": "兰蔻菁纯眼霜20ml 淡纹抗皱滋润紧致 化妆品护肤套装礼盒生日礼物女",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/122974/25/38141/101482/650bfbe2F82c5442a/c59b7e83c34f9301.jpg.dpg",
"price": "1200",
"promotion_price": "1200",
"sales": 446386,
"num_iid": "100016492604",
"shop_id": "1000306683",
"cid": "1381",
"similarity": "0.97103101",
"detail_url": "https://item.jd.com/100016492604.html"
},
{
"title": "兰蔻菁纯眼霜20ml淡化细纹滋润 化妆护肤品礼盒母亲节生日礼物女",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/109602/37/42432/130785/660a7b18F04ff95e7/fd3c09586c1f5b60.jpg.dpg",
"price": "1200",
"promotion_price": "1200",
"sales": 446469,
"num_iid": "100006061653",
"shop_id": "1000306683",
"cid": "1381",
"similarity": "0.924962938",
"detail_url": "https://item.jd.com/100006061653.html"
},
{
"title": "兰蔻菁纯臻颜精萃乳霜 轻盈型 15ml",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/196373/3/38215/21960/65001549Fc8abeb4e/32b1ab94a4832f78.jpg.dpg",
"price": "188",
"promotion_price": "188",
"sales": 57,
"num_iid": "100068357101",
"shop_id": "1000376954",
"cid": "1381",
"similarity": "0.874867439",
"detail_url": "https://item.jd.com/100068357101.html"
},
{
"title": "兰蔻菁纯臻颜焕亮眼霜 20ml 礼物 生日礼物",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/92002/4/41335/96553/659f5fa2Fecdd97c6/d82bca3a086379fc.jpg.dpg",
"price": "809",
"promotion_price": "809",
"sales": 2,
"num_iid": "10095395600359",
"shop_id": "12623281",
"cid": "1381",
"similarity": "0.925075829",
"detail_url": "https://item.jd.com/10095395600359.html"
},
{
"title": "兰蔻面霜 菁纯臻颜乳霜小黑瓶塑颜黑金臻宠紧致抗皱淡纹保湿滋润面霜 菁纯面霜15ml(滋润型)",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/192733/10/40449/92400/653cac71F573b3dea/045ef21587bc8def.jpg.dpg",
"price": "289",
"promotion_price": "289",
"sales": 816,
"num_iid": "10089558498414",
"shop_id": "11888304",
"cid": "1381",
"similarity": "0.857580185",
"detail_url": "https://item.jd.com/10089558498414.html"
},
{
"title": "兰蔻菁纯化妆品护肤套装(水150ml+菁纯眼霜20ml+面霜60ml)母亲节礼盒",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/239976/29/1260/137957/658cef2eFf6d8c08d/cc052b5e2bc17ea7.jpg.dpg",
"price": "5050",
"promotion_price": "5050",
"sales": 61542,
"num_iid": "100011480196",
"shop_id": "1000306683",
"cid": "1381",
"similarity": "0.918485761",
"detail_url": "https://item.jd.com/100011480196.html"
},
{
"title": "兰蔻(LANCOME)菁纯玫瑰精华水面霜眼霜套装【520礼物】 菁纯9件套组合",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/99935/17/46634/39808/65defb7eFa1b13255/560faa99250631ee.jpg.dpg",
"price": "399",
"promotion_price": "399",
"sales": 83,
"num_iid": "10097114067250",
"shop_id": "13503717",
"cid": "1381",
"similarity": "0.822784901",
"detail_url": "https://item.jd.com/10097114067250.html"
},
{
"title": "兰蔻菁纯臻颜淡纹眼霜 淡化细纹 520情人节礼物 护肤品 女生 兰 蔻 20ml",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/105842/16/47356/39300/6604e3ebF2ebed2ea/45db92d4e0b0bf7e.jpg.dpg",
"price": "990",
"promotion_price": "990",
"sales": 1,
"num_iid": "10099544230452",
"shop_id": "13005886",
"cid": "1381",
"similarity": "0.913681746",
"detail_url": "https://item.jd.com/10099544230452.html"
},
{
"title": "兰蔻(LANCOME)菁纯眼霜 臻颜焕亮眼霜保湿抗皱提拉紧致淡化细纹黑眼圈 生日礼物 菁纯眼霜20ml",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/227331/1/14506/30697/65dff989Fcef5e23f/4544a8d34a76a28f.jpg.dpg",
"price": "579",
"promotion_price": "579",
"sales": 3,
"num_iid": "10097677003555",
"shop_id": "10324998",
"cid": "1381",
"similarity": "0.9187181",
"detail_url": "https://item.jd.com/10097677003555.html"
},
{
"title": "兰蔻(LANCOME)菁纯面霜臻颜精萃乳霜( 轻盈)15ml*1 中小样,介意慎拍 滋润",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/59772/6/26665/31142/64ad017eF88bdaa6b/efd0f39a6887ee58.jpg.dpg",
"price": "178.9",
"promotion_price": "178.9",
"sales": 183,
"num_iid": "100058487438",
"shop_id": "1000402521",
"cid": "1381",
"similarity": "0.863538206",
"detail_url": "https://item.jd.com/100058487438.html"
},
{
"title": "兰蔻(LANCOME)菁纯面霜臻颜精萃乳霜( 轻盈)15ml*3 中小样,介意慎拍 滋润",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/171243/18/34006/54335/64ad024cF9291d256/f6a2993899075226.jpg.dpg",
"price": "528.9",
"promotion_price": "528.9",
"sales": 4985,
"num_iid": "100058487412",
"shop_id": "1000402521",
"cid": "1381",
"similarity": "0.852924645",
"detail_url": "https://item.jd.com/100058487412.html"
},
{
"title": "兰蔻(LANCOME)菁纯眼霜 淡化细纹 补水保湿 护肤品生日礼物送女友老婆 菁纯眼霜20ml",
"pic_url": "https://img13.360buyimg.com/n1/jfs/t1/107796/19/34103/55637/65083e30F11bac4ce/c0adb92c0391cbab.jpg.dpg",
"price": "657",
"promotion_price": "657",
"sales": 83,
"num_iid": "10086334106308",
"shop_id": "12188609",
"cid": "1381",
"similarity": "0.910702527",
"detail_url": "https://item.jd.com/10086334106308.html"
},
{
"title": "兰蔻 LANCOME 菁纯臻颜焕亮眼霜20ml",
"pic_url":
技术冰糖葫芦
还未添加个人签名 2023-11-13 加入
还未添加个人简介
评论