0

我正在尝试搜索 sears 中存储在字符串中的项目。

我注意到每当我输入:

http://www.sears.com/search=summer clothes

在我的谷歌浏览器的搜索栏中,它会自动将其转换为:

http://www.sears.com/search=summer%20clothes?catalogId=12605&storeId=10153&levels=Clothing&autoRedirect=true&viewItems=25&redirectType=CAT_REC_PRED

因此,我的策略是让 Jsoup 获取该站点并遵循重定向。

String url = "http://www.sears.com/search=summer clothes";
Document document = Jsoup.connect(url).followRedirects(true).get();

然而,它实际上带我去的网站是http://www.sears.com/search=summer ?.... 有效地切断了“衣服”。

为什么会这样?我尝试用 %20 替换 URL 中的空格,但这实际上会导致错误。

4

1 回答 1

0

他们可能正在使用 JavaScript 重定向。

于 2013-09-26T11:53:31.983 回答