【发布时间】:2019-03-26 06:06:43
【问题描述】:
JSoup 似乎适用于我尝试过的几乎所有 URL,但这个给了我 400 错误。
String url = "http://localad.walmart.com?storeref=3008&forceview=y";
Response response = Jsoup.connect(url.replaceAll(" ", "%20"))
.method(Method.GET)
.userAgent("Mozilla")
.followRedirects(false)
.timeout(5000)
.data("pragma", "no-cache")
.execute();
我得到的错误是:
Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=400, URL=http://localad.walmart.com?storeref=3008&forceview=y&pragma=no-cache
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:449)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:424)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:178)
【问题讨论】:
-
你能帮忙解决这种情况吗?你有答案吗?
标签: jsoup