JSOUP org.jsoup.HttpStatusException HTTP error fetching URL. Status=403, URL=

 

org.jsoup.HttpStatusException: HTTP error fetching URL. Status=403, URL=http://xxxx.com/xxx/xxx/xxx.html

 

设置下userAgent,伪装成浏览器就可以了

 
Jsoup.connect("http://xxxx.com/xxx/xxx/xxx.html").userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31");

 

你可能感兴趣的:(exception)