public static void main(String[] args) {
String[] ips = "58.220.74.143:80".split(":");
Connection connection = Jsoup.connect("http://esf.org.cn/new/pub/HouseSearch").ignoreContentType(true)
.proxy(ips[0], Integer.parseInt(ips[1])).timeout(10000);
connection.header("Host", "esf.org.cn");
connection.header("Referer", "http://esf.org.cn/new/publish/");
connection.header("Origin", "http://esf.org.cn");
connection.header("User-Agent", Agent.getRandom());
connection.header("Content-Type", "application/x-www-form-urlencoded");
connection.header("Accept", "application/json, text/javascript, */*; q=0.01");
connection.header("X-Requested-With", "XMLHttpRequest");
connection.data("index", "0");
connection.data("size", "10");
connection.data("drection", "1");
connection.data("order", "0");
try {
Document document = connection.post();
JSONObject jsonObject = JSONObject.parseObject(document.body().text());
System.err.println(jsonObject);
} catch (Exception e){
//更换ip重新爬取
}
}
Jsoup执行post方法调用接口
最新推荐文章于 2023-01-27 12:51:10 发布