我想使用Jsoup连接https网址 我跟着How to connect via HTTPS using Jsoup??
但现在我正在
Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=401, URL=myurl
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:435)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:410)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:164)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:153)
at FIndItNow.main(FIndItNow.java:27)
知道如何解决这个问题吗?
我打电话给
Document doc = Jsoup.connect(myurl).userAgent("Mozilla").get();
答案 0 :(得分:1)
错误401表示它是未经授权的请求。您似乎需要在请求中发送一些身份验证标头。要么你没有发送它们,要么那些不正确。