当涉及到淘宝店铺的所有商品接口,我们可以利用淘宝开放平台提供的API进行操作。
(首先,我们需要确保已经在淘宝开放平台注册并创建了应用,并获取了相应的App Key和App Secret。)
1. 获取授权:使用OAuth 2.0协议对应用进行授权,以便能够访问店铺的商品信息。
2. 获取店铺信息:使用淘宝API的taobao.shop.get接口,传入店铺的user_id参数,获取店铺的基本信息。
3. 获取店铺所有商品列表:使用淘宝API的taobao.items.onsale.get接口,传入店铺的nick(即卖家昵称)和当前页码,以及其他可选参数,如每页返回的结果数等。该接口将返回店铺在售的所有商品列表。
4. 分页获取商品列表:由于一个店铺可能拥有大量商品,我们可以通过多次调用分页接口来获取全部商品信息。通过传入不同的页码,循环调用taobao.items.onsale.get接口,直至获取完所有商品。
5. 获取商品详细信息:对于获取到的商品列表中的每个商品,我们可以使用淘宝API的taobao.item.get接口,传入商品的num_iid参数,获取商品的详细信息,包括标题、价格、库存等。
点击获取key和secret
淘宝/天猫获得店铺的所有商品 API 返回值说明
请求参数:seller_id=3998713333&page=1&sort=
参数说明: shop_id:shop_id(暂时失效)
seller_id:seller_id(详情接口可获取)
sort:排序[new,bid,sale]
(new 新品,bid:价格,sale:销量,bid加_前缀为从大到小排序)
---------------------------------------
Result Object:
---------------------------------------
{
"items": {
"shop_id": 2179580312,
"page": "1",
"real_total_results": 122,
"total_results": 122,
"page_size": 10,
"page_count": 13,
"_ddf": "xdl",
"item": [
{
"num_iid": 40677819879,
"pic_url": "https://g.search.alicdn.com/img/bao/uploaded/i4/i4/2179580312/O1CN01S7xAWF1EAwETOKXC8_!!2179580312.jpg",
"title": "长征交流接触器LC1 CJX2-1810 1801 36/220/380V 铜件银点",
"promotion_price": 15,
"price": 15,
"sales": 2,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=40677819879"
},
{
"num_iid": 40949997660,
"pic_url": "https://g.search1.alicdn.com/img/bao/uploaded/i4/i4/2179580312/O1CN01nTPbUG1EAw8CQsjgH_!!2179580312.jpg",
"title": "长城电声 外击拷棒式无火花铸铁电铃10寸 SHF-250mm工厂学校打铃",
"promotion_price": 50,
"price": 50,
"sales": 3,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=40949997660"
},
{
"num_iid": 41653436325,
"pic_url": "https://g.search2.alicdn.com/img/bao/uploaded/i4/i1/2179580312/O1CN01n9i1Po1EAw8lkkBHj_!!2179580312.jpg",
"title": "双泰STSHK11-2P-63A双电源备用转换刀闸开关双投倒顺铡刀220V",
"promotion_price": 32,
"price": 32,
"sales": 0,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=41653436325"
},
{
"num_iid": 44942082259,
"pic_url": "https://g.search3.alicdn.com/img/bao/uploaded/i4/i2/2179580312/O1CN01MPtS481EAwDmERoHR_!!2179580312.jpg",
"title": "富士数显时间继电器时间控制器定时器JSS48A DH48S-2Z/1Z富威220V",
"promotion_price": 40,
"price": 40,
"sales": 1,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=44942082259"
},
{
"num_iid": 521539790424,
"pic_url": "https://g.search.alicdn.com/img/bao/uploaded/i4/i1/2179580312/O1CN01rvArZe1EAwA67IDxu_!!2179580312.jpg",
"title": "DZ15LD-100 40/63/250A电动机缺相漏电保护器潜水泵开关可调定时",
"promotion_price": 55,
"price": 55,
"sales": 1,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=521539790424"
},
{
"num_iid": 526099535471,
"pic_url": "https://g.search1.alicdn.com/img/bao/uploaded/i4/i3/2179580312/O1CN01JjKCHK1EAwR3DSHNN_!!2179580312.jpg",
"title": "上海港博行车控制电葫芦起重机按钮开关COBTNHA1-64HB带急停开关",
"promotion_price": 40,
"price": 40,
"sales": 1,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=526099535471"
},
{
"num_iid": 532018520357,
"pic_url": "https://g.search2.alicdn.com/img/bao/uploaded/i4/i1/2179580312/O1CN01nLwFYi1EAwCnUkQfL_!!2179580312.jpg",
"title": "正品上海稳宝WBD1-B100KA/4P 60-100KA浪涌电涌保护器 防雷避雷器",
"promotion_price": 120,
"price": 120,
"sales": 0,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=532018520357"
},
{
"num_iid": 557255682840,
"pic_url": "https://g.search3.alicdn.com/img/bao/uploaded/i4/i4/2179580312/O1CN01QMHmxw1EAwI49jCfn_!!2179580312.jpg",
"title": "正品乾威QWE-600ZII型三相直流电弧焊机二次降压防触电智能保护器",
"promotion_price": 260,
"price": 260,
"sales": 1,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=557255682840"
},
{
"num_iid": 631293386061,
"pic_url": "https://g.search.alicdn.com/img/bao/uploaded/i4/i1/2179580312/O1CN01CiXeKu1EAwCvOAtWI_!!2179580312.jpg",
"title": "一锦光伏自复位式过欠压延时防雷保护器YJQG-40/63/100A三相380V",
"promotion_price": 65,
"price": 65,
"sales": 2,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=631293386061"
},
{
"num_iid": 634903113165,
"pic_url": "https://g.search1.alicdn.com/img/bao/uploaded/i4/i4/2179580312/O1CN01TVtQ4O1EAwDkhG3BR_!!2179580312.jpg",
"title": "腾泰电源浪涌保护器CHT1-B40KA/2P/4P家用配电箱柜避防雷器模块",
"promotion_price": 20,
"price": 20,
"sales": 2,
"seller_id": "2179580312",
"shop_id": 2179580312,
"detail_url": "https://item.taobao.com/item.htm?id=634903113165"
}
]
},
"error_code": "0000",
"reason": "ok",
"secache": "767f9f50277e541e57f54e2b96f0924a",
"secache_time": 1692268935,
"secache_date": "2023-08-17 18:42:15",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"error": "",
"cache": 1,
"api_info": "today:118 max:10100 all[175=118+31+26];expires:2030-12-31",
"execution_time": "0.33",
"server_time": "Beijing/2023-08-23 13:50:52",
"client_ip": "106.7.5.65",
"call_args": {
"start_price": "1"
},
"api_type": "taobao",
"translate_language": "zh-CN",
"translate_engine": "baidu",
"server_memory": "6.06MB",
"request_id": "gw-3.64e59e3c030c2",
"last_id": "1975609302"
}