可以通过京东店铺所有商品API接口采集店铺所有商品详情页各项数据,包含商品标题,SKU信息、价格、优惠价,收藏数、销量、SKU图、标题、详情页图片等店铺内页面上有的数据均可以拿到,大家都知道,京东的反爬虫机制十分严,而很多时候,没办法高效的拿到数据内容响应终端需求,而依赖爬虫就会造成动不动就出现滑块验证,让人很无解,正好,公司有这样的需求,让我负责解决这个问题,刚开始各种尝试,始终没有绕过京东的滑块验证码,搞了好几天,都没有进展;
然后各种网上资料查询,最终还是不负努力,找到更好的解决方案,让采集不再出现任何滑块验证码,完全解密通过,实现更好的用户体验,已经封装成了京东店铺所有商品API接口、京东店铺列表API接口,京东店铺API接口,京东店铺查询商品API接口,京东店铺商品API接口,支持高并发调用接口,可以用于不同的业务场景,包括淘宝店铺所有商品接口,1688店铺所有商品接口,抖音店铺所有商品接口,小红书店铺所有商品接口,京东店铺详情接口,亚马逊店铺所有商品API接口,速卖通店铺所有商品API接口,唯品会店铺所有商品API接口,拼多多店铺所有商品API接口等 均可以适用,希望能够帮助到有需要的朋友,下面是接口代码对接展示:
1.公共参数
名称 | 类型 | 必须 | 描述 |
---|---|---|---|
key | String | 是 | 调用key(必须以GET方式拼接在URL中,点击获取测试key和secret) |
secret | String | 是 | 调用密钥 |
api_name | String | 是 | API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等] |
cache | String | 否 | [yes,no]默认yes,将调用缓存的数据,速度比较快 |
result_type | String | 否 | [json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读 |
lang | String | 否 | [cn,en,ru]翻译语言,默认cn简体中文 |
version | String | 否 | API版本 |
2.请求参数
请求参数:seller_nick=皓顿HAUTTON京东自营旗舰店&start_price=0&end_price=0&q=&page=1&cid=
参数说明:seller_nick:店铺昵称
start_price:开始价格
end_price:结束价格
q:搜索关键字
page:页数
cid:分类ID
3.响应参数
4.请求示例(CURL、PHP 、PHPsdk 、Java 、C# 、Python…)
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.nio.charset.Charset;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.PrintWriter;
import java.net.URLConnection;
public class Example {
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.print(body);
out.flush();
InputStream instream = conn.getInputStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
instream.close();
}
}
public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
InputStream instream = conn.getInputStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
instream.close();
}
}
public static void main(String[] args) throws IOException, JSONException {
// 请求示例 url 默认请求参数已经URL编码处理
String url = "https://wx19970108018/jd/item_search_shop/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&seller_nick=皓顿HAUTTON京东自营旗舰店&start_price=0&end_price=0&q=&page=1&cid=";
JSONObject json = getRequestFromUrl(url);
System.out.println(json.toString());
}
}
5.响应示例
{
"user": {
"id": "",
"nick": "皓顿HAUTTON京东自营旗舰店",
"city": "",
"state": "",
"good_num": "",
"level": "",
"score": "",
"total_num": "",
"created": "",
"shop_type": "B",
"user_num_id": 1000081830,
"cid": "",
"pic_url": "",
"delivery_score": "",
"item_score": "",
"sid": "",
"title": "",
"phone": "",
"zhuy": "//mall.jd.com/index-1000081830.html?from=pc",
"score_p": "",
"company_name": ""
},
"items": {
"item": [
{
"num_iid": "100006965163",
"detail_url": "https://item.jd.com/100006965163.html",
"title": "皓顿休闲鞋男鞋头层牛皮时尚潮牌运动小白鞋百搭板鞋子男 9301XB148 白色 38码",
"pic_url": "//img13.360buyimg.com/n7/jfs/t1/153961/17/1801/305679/5f813073E03c570f7/8d5a59f610675771.jpg",
"price": 368,
"promotion_price": 368,
"sales": null,
"sample_id": "",
"post_fee": "",
"seller": "皓顿HAUTTON京东自营旗舰店"
},
{
"num_iid": "100008260461",
"detail_url": "https://item.jd.com/100008260461.html",
"title": "皓顿HAUT TON 休闲鞋男鞋头层牛皮高帮时尚潮牌运动小白鞋百搭板鞋靴子男 9393XB540 白色 39码",
"pic_url": "//img11.360buyimg.com/n7/jfs/t1/131902/17/11990/270074/5f813353E3ad47052/9d15482c3a553659.jpg",
"price": 398,
"promotion_price": 398,
"sales": null,
"sample_id": "",
"post_fee": "",
"seller": "皓顿HAUTTON京东自营旗舰店"
},
{
"num_iid": "100006965175",
"detail_url": "https://item.jd.com/100006965175.html",
"title": "皓顿休闲鞋男鞋头层牛皮时尚潮牌运动小白鞋百搭板鞋子男 9301XB148 白色 41码",
"pic_url": "//img10.360buyimg.com/n7/jfs/t1/129151/18/14410/305679/5f813097E2b67ae38/594356ed51abb69c.jpg",
"price": 368,
"promotion_price": 368,
"sales": null,
"sample_id": "",
"post_fee": "",
"seller": "皓顿HAUTTON京东自营旗舰店"
},
{
"num_iid": "100014803052",
"detail_url": "https://item.jd.com/100014803052.html",
"title": "皓顿HAUT TON 休闲鞋男鞋头层牛皮高帮时尚潮牌运动小白鞋百搭板鞋靴子男 9394GB411 白色 41码",
"pic_url": "//img12.360buyimg.com/n7/jfs/t1/128350/32/14720/262542/5f813012E457e96c4/bdf4fc8345082f34.jpg",
"price": 398,
"promotion_price": 398,
"sales": null,
"sample_id": "",
"post_fee": "",
"seller": "皓顿HAUTTON京东自营旗舰店"
},
{
"num_iid": "100012921200",
"detail_url": "https://item.jd.com/100012921200.html",
"title": "皓顿HAUT TON 休闲鞋男鞋头层牛皮韩版时尚潮牌运动小白鞋百搭板鞋子男 9303XB030 白色 39码",
"pic_url": "//img10.360buyimg.com/n7/jfs/t1/152705/30/1828/298006/5f812e75Ee03a3a12/3abde62340b8d3f6.jpg",
"price": 368,
"promotion_price": 368,
"sales": null,
"sample_id": "",
"post_fee": "",
"seller": "皓顿HAUTTON京东自营旗舰店"
}
],
"total_results": "5",
"page_size": "60",
"pagecount": 1,
"page": "",
"url": "https://search.jd.com/Search?keyword=皓顿HAUTTON京东自营旗舰店&enc=utf-8&wq=皓顿HAUTTON京东自营旗舰店&pvid=33dbb420d9fa4ca483a869f2e4c5625c"
},
"error": "",
"secache": "e0f8552465a91326c012ad26414763d9",
"secache_time": 1615538585,
"secache_date": "2021-03-12 16:43:05",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"reason": "",
"error_code": "0000",
"cache": 0,
"api_info": "today:11 max:10000",
"execution_time": 3.413,
"server_time": "Beijing/2021-03-12 16:43:06",
"client_ip": "106.6.36.174",
"call_args": [
"100006965163"
],
"api_type": "jd",
"translate_language": "zh-CN",
"translate_engine": "google_cn",
"server_memory": "3.16MB",
"request_id": "gw-3.604b299752ee5"
}