利用电商API获取数据的步骤
1.申请API接口:首先要在相应电商平台上注册账号并申请API接口。
2.获取授权:在账号注册成功后,需要获取相应的授权才能访问电商API。
3.调用API:根据电商API提供的请求格式,通过编程实现相关接口的调用。
4.解析数据:API返回的数据一般是json或xml格式,需要对数据进行解析处理。
5.存储与分析:最后,把解析成功的数据进行存储和分析,以便更好地了解市场情况、产品热度、消费趋势等信息。
商品详情api接口数据:苏宁提供了商品的基本信息,包括商品名称、描述、规格、价格、销量、库存等信息。此外,也可以通过淘宝提供的API接口来获取商品的图片、评价、物流信息等详细数据。
苏宁详情页面数据的采集(商品信息,价格销量,详情图)代码对接如下:
item_get-获得suning商品详情
请求地址:点击获取请key和secret
请求参数:num_iid=0070143049/12308658700
参数说明:num_iid:店铺ID/商品ID
页面上的数据均可获取
请求示例Curl PHP PHPsdk JAVA C# Python
# 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_app/?key=t5913787172&secret=DE289AA1B5BDD0ECB8FC2AF3FBDC94FC&num_iid=520813250866"
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
}
if __name__ == "__main__":
r = requests.get(url, headers=headers)
json_obj = r.json()
print(json_obj)
响应示例
{
"item": {
"num_iid": "0070143049/12308658700",
"title": "海尔(Haier)10公斤 大容量 全自动家用 变频 滚筒洗衣机 高温除菌除螨 自清洁 工厂直营 EG100MATE2S",
"desc_short": "",
"price": "2499.00",
"total_price": 0,
"suggestive_price": 0,
"orginal_price": "",
"nick": null,
"num": "99",
"min_num": 0,
"detail_url": "http://product.suning.com/0070143049/12308658700.html",
"pic_url": "//imgservice.suning.cn/uimg1/b2c/image/j2JpaCU6ydiwIaRkdeTgiw.jpg_400w_400h_4e",
"brand": null,
"brandId": null,
"rootCatId": null,
"cid": null,
"crumbs": {
"0": "大家电",
"244006": "洗衣机",
"288008": "洗(烘)衣机"
},
"created_time": "",
"modified_time": "",
"delist_time": "",
"desc": "<img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/LdR2s9stSpFrg3upyYFN9g.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/IpCjwMNOZxS3VR_0ynkY4Q.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/VpJrnExOkYC5nYWgb1VRvg.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/Ge168t0pJcnJuIqh4ODPOg.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/Dxoi4uub3_XudNM6FDDuIQ.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/t7PtON24ZYdCrH3Hdu725A.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/sP01xB7NHFYEuRUdr8PmwQ.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/7WBsefv1-EEW8RxlTE_jAg.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/4ye-6SAw4zBM1D3aYRQAJg.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/i40gjfg0qpN6WfqoNshI3A.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/c2k-ltYhDs9APIgalbJJfg.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/rqJqAACM6h_YJpR75xvFBw.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/oGtZ0BfbGsGtBYWh64kaEQ.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/5cqIU4F4fNTNOMqrlsHQpA.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/Gj6TLAm7ZyVIK4kGk8JtYw.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/j-NKzfJcvPK8ChGHk-1ohQ.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/q52p-Fv91MjyegjEabUDlA.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/1m9RAyku-RdR1QI9QIB4HQ.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/KNJEkeVVbIFy7Np-5GZ1jQ.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/vmEIr1fZ2jD9lVMv_cjPBw.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/_Zmw2XLqIAQPO6DetHeSHA.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/HF8HFhStGa9APWv4vBqk1A.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/ckhBNDSlolLVF90Q25nexw.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/i0qJTB1zYii7PLdAxUAgLg.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/nQ0JmZ1mwzCqq2ab0qpODg.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/5mhDa_bZx2s-5hxt0CVZTA.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/mej2q4a9Z8_J-IYGfun19w.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/n-aB8isrBETNLdm78E_Dgg.jpg\" /><img src=\"https://uimgproxy.suning.cn/uimg1/sop/commodity/9tAQf62D7QA3pR2b3PoVLg.jpg\" /><img src=\"https://www.o0b.cn/i.php?t.png&rid=gw-4.64acc75484cc3&p=3060574555&k=i_key&t=1689044825\" style=\"display:none\" />",
"desc_img": [
"https://uimgproxy.suning.cn/uimg1/sop/commodity/LdR2s9stSpFrg3upyYFN9g.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/IpCjwMNOZxS3VR_0ynkY4Q.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/VpJrnExOkYC5nYWgb1VRvg.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/Ge168t0pJcnJuIqh4ODPOg.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/Dxoi4uub3_XudNM6FDDuIQ.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/t7PtON24ZYdCrH3Hdu725A.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/sP01xB7NHFYEuRUdr8PmwQ.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/7WBsefv1-EEW8RxlTE_jAg.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/4ye-6SAw4zBM1D3aYRQAJg.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/i40gjfg0qpN6WfqoNshI3A.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/c2k-ltYhDs9APIgalbJJfg.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/rqJqAACM6h_YJpR75xvFBw.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/oGtZ0BfbGsGtBYWh64kaEQ.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/5cqIU4F4fNTNOMqrlsHQpA.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/Gj6TLAm7ZyVIK4kGk8JtYw.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/j-NKzfJcvPK8ChGHk-1ohQ.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/q52p-Fv91MjyegjEabUDlA.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/1m9RAyku-RdR1QI9QIB4HQ.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/KNJEkeVVbIFy7Np-5GZ1jQ.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/vmEIr1fZ2jD9lVMv_cjPBw.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/_Zmw2XLqIAQPO6DetHeSHA.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/HF8HFhStGa9APWv4vBqk1A.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/ckhBNDSlolLVF90Q25nexw.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/i0qJTB1zYii7PLdAxUAgLg.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/nQ0JmZ1mwzCqq2ab0qpODg.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/5mhDa_bZx2s-5hxt0CVZTA.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/mej2q4a9Z8_J-IYGfun19w.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/n-aB8isrBETNLdm78E_Dgg.jpg",
"https://uimgproxy.suning.cn/uimg1/sop/commodity/9tAQf62D7QA3pR2b3PoVLg.jpg"
],
"item_imgs": [
{
"url": "//imgservice.suning.cn/uimg1/b2c/image/j2JpaCU6ydiwIaRkdeTgiw.jpg_800w_800h_4e"
},
{
"url": "//imgservice.suning.cn/uimg1/b2c/image/ITL6DByL66L-xLXTihzKpQ.jpg_800w_800h_4e"
},
{
"url": "//imgservice.suning.cn/uimg1/b2c/image/_dmhe_yYPsFeqVm8hLurMg.jpg_800w_800h_4e"
},
{
"url": "//imgservice.suning.cn/uimg1/b2c/image/AJHOQreowDFpRMCyyNhxKA.jpg_800w_800h_4e"
},
{
"url": "//imgservice.suning.cn/uimg1/b2c/image/2o-3y_vMT0wkbOG39c5-7g.jpg_800w_800h_4e"
},
{
"url": "//imgservice.suning.cn/uimg1/b2c/image/XnezMM9CUl3MDgv-hi1W1A.jpg_800w_800h_4e"
},
{
"url": "//imgservice.suning.cn/uimg1/b2c/image/8A-uPKtZHBzGkjnxGpnOfA.jpg_800w_800h_4e"
},
{
"url": "//imgservice.suning.cn/uimg1/b2c/image/hpQ9qsGw7y_OGwz6K1C7xg.jpg_800w_800h_4e"
},
{
"url": "//imgservice.suning.cn/uimg1/b2c/image/P6oqjIdM7bHBTnt8up9IiQ.jpg_800w_800h_4e"
}
],
"item_weight": "",
"item_size": "",
"location": "",
"post_fee": "",
"express_fee": "",
"ems_fee": "",
"shipping_to": "",
"has_discount": "",
"video": [],
"is_virtual": "",
"sample_id": "",
"is_promotion": "",
"props_name": "0:0:系列:【除菌除螨】性价比优选;0:1:系列:【7公斤超薄】租房优选;0:2:系列:【热销】直驱热泵洗干套装;0:3:系列:【磁悬浮直驱】晶彩屏双智能",
"prop_imgs": {
"prop_img": []
},
"property_alias": "0:0:【除菌除螨】性价比优选;0:1:【7公斤超薄】租房优选;0:2:【热销】直驱热泵洗干套装;0:3:【磁悬浮直驱】晶彩屏双智能",
"props": [
{
"name": "品牌",
"value": "海尔(Haier)"
},
{
"name": "型号",
"value": "海尔洗衣机10公斤 全自动家用滚筒M-A-T-E-2-S"
},
{
"name": "颜色",
"value": "星蕴银"
},
{
"name": "产品类型",
"value": "滚筒"
},
{
"name": "系列",
"value": "MATE系列"
},
{
"name": "上市时间(月)",
"value": "2021-02"
},
{
"name": "产地",
"value": "中国山东青岛市"
},
{
"name": "自动化程度",
"value": "全自动"
},
{
"name": "控制方式",
"value": "电脑式"
},
{
"name": "开门方式",
"value": "前开式"
},
{
"name": "排水方式",
"value": "上排水"
},
{
"name": "显示屏",
"value": "LED数码显示"
},
{
"name": "内桶材质",
"value": "不锈钢"
},
{
"name": "箱体材料",
"value": "渗锌钢板"
},
{
"name": "适用家庭",
"value": "四口及以上"
},
{
"name": "整机质保年限",
"value": "3年"
},
{
"name": "CCC认证编号",
"value": "2015010705782248"
},
{
"name": "变频 ×",
"value": "变频"
},
{
"name": "预约",
"value": "有"
},
{
"name": "中途添加衣物",
"value": "有"
},
{
"name": "DD电机 ×",
"value": "无"
},
{
"name": "水温范围",
"value": "冷水~90℃"
},
{
"name": "童锁功能",
"value": "有"
},
{
"name": "加热功能",
"value": "有"
},
{
"name": "转速",
"value": "1200转/分"
},
{
"name": "标准程序耗电量",
"value": "0.69度"
},
{
"name": "自动断电",
"value": "有"
},
{
"name": "烘干方式",
"value": "自然干"
},
{
"name": "自动排水",
"value": "是"
},
{
"name": "洗衣程序",
"value": "日常洗、速洗、大物、衬衣、内衣、新衣洗、羽绒、除菌螨、超柔、羊毛、牛仔、顽渍洗、香薰/除菌、单脱水、漂洗+脱水、筒自洁"
},
{
"name": "智能类型",
"value": "非智能"
},
{
"name": "断电记忆",
"value": "支持"
},
{
"name": "其他功能",
"value": "电磁门锁、预约、童锁"
},
{
"name": "产品重量",
"value": "71千克"
},
{
"name": "洗净比",
"value": "1.08"
},
{
"name": "电压/频率",
"value": "220V/50Hz"
},
{
"name": "国家能效等级 ×",
"value": "1级"
},
{
"name": "洗衣容量",
"value": "10千克"
},
{
"name": "洗涤功率",
"value": "200瓦"
},
{
"name": "脱水容量",
"value": "10千克"
},
{
"name": "脱水功率",
"value": "500瓦"
},
{
"name": "洗涤噪音",
"value": "52分贝"
},
{
"name": "标准程序耗水量",
"value": "54升"
},
{
"name": "产品尺寸(宽*深*高)",
"value": "595*600*850毫米"
},
{
"name": "包装尺寸(宽*深*高)",
"value": "713*690*940毫米"
}
],
"total_sold": "",
"skus": {
"sku": [
{
"price": "2499.00",
"orginal_price": null,
"properties": "0:0;",
"properties_name": "0:0:系列:【除菌除螨】性价比优选",
"sku_id": "000000012308658700"
},
{
"price": null,
"orginal_price": null,
"properties": "0:1;",
"properties_name": "0:1:系列:【7公斤超薄】租房优选",
"sku_id": "000000000166440092"
},
{
"price": "9999.00",
"orginal_price": null,
"properties": "0:2;",
"properties_name": "0:2:系列:【热销】直驱热泵洗干套装",
"sku_id": "000000012209314597"
},
{
"price": "3999.00",
"orginal_price": null,
"properties": "0:3;",
"properties_name": "0:3:系列:【磁悬浮直驱】晶彩屏双智能",
"sku_id": "000000012356876039"
}
]
},
"seller_id": "",
"sales": 0,
"shop_id": "70143049",
"props_list": {
"0:0": "系列:【除菌除螨】性价比优选",
"0:1": "系列:【7公斤超薄】租房优选",
"0:2": "系列:【热销】直驱热泵洗干套装",
"0:3": "系列:【磁悬浮直驱】晶彩屏双智能"
},
"seller_info": {
"nick": null,
"city": null,
"shopid": "70143049",
"shopname": null,
"title": null,
"zhuy": "https://shop.suning.com/70143049/index.html",
"tel": null
},
"tmall": "false",
"error": "",
"warning": "",
"url_log": [],
"sold": null,
"props_img": [],
"shopinfo": {
"shop_name": null
},
"format_check": "ok",
"shop_item": [],
"relate_items": []
},
"error": "",
"secache": "ef16127e4391315b0c81f8e82ff045f6",
"secache_time": 1689044825,
"secache_date": "2023-07-11 11:07:05",
"translate_status": "error",
"translate_time": 0,
"language": {
"current_lang": "cn",
"source_lang": "zh-CN"
},