首页 > 大数据 > 可视化 > Java爬虫获取1688关键字接口详细解析
javaString url = "https://api.1688.com/?key=AppKey&secret=AppSecret&q=商品关键字";
javaimport org.apache.http.client.methods.HttpGet;import org.apache.http.impl.client.CloseableHttpClient;import org.apache.http.impl.client.HttpClients;import org.apache.http.util.EntityUtils;public class AlibabaApiCrawler {
public static void main(String[] args) {
String url = "https://api.1688.com/item_get?num_iid=610947572360&app_key=your_app_key×tamp=your_timestamp&sign=your_sign";
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(url);
try {
CloseableHttpResponse response = httpClient.execute(httpGet);
String json = EntityUtils.toString(response.getEntity());
System.out.println(json);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
httpClient.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}}
robots.txt文件规定
。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70041666/viewspace-3058732/ ,如需转载,请注明出处,否则将追究法律责任。