문제

I want to connect https url using Jsoup I followed How to connect via HTTPS using Jsoup??

But now I am getting

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)

Any idea how to fix this ?

I am calling like

Document doc = Jsoup.connect(myurl).userAgent("Mozilla").get();
도움이 되었습니까?

해결책

As error 401 says it is an UNAUTHORIZED request. It seems you need send some authentication headers in the request. Either you are not sending them or those are not correct.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top