- A+
private Document requestDoc(String url)
{
Document doc = null;
try
{
System.setProperty("https.proxySet", "true");
System.getProperties().put("https.proxyHost", "127.0.0.1");
System.getProperties().put("https.proxyPort", 8580);
Map<String, String> headers = new HashMap<String, String>();
headers.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
headers.put("Accept-Language", "zh-CN,zh;q=0.9");
doc = Jsoup.connect(url)
.userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36")
.timeout(20 * 1000)
.get();
}
catch (IOException e)
{
log.error("fetchSingleDoc error", e);
}
return doc;
}
- 我的微信
- 这是我的微信扫一扫
-
- 我的微信公众号
- 我的微信公众号扫一扫
-