问题
I am trying to search sears for an item, which I store in a String.
I notice that whenever I type:
http://www.sears.com/search=summer clothes
in the search bar in my google chrome, it automatically converts it to:
http://www.sears.com/search=summer%20clothes?catalogId=12605&storeId=10153&levels=Clothing&autoRedirect=true&viewItems=25&redirectType=CAT_REC_PRED
Therefore, my strategy is to have Jsoup fetch this site and follow redirects.
String url = "http://www.sears.com/search=summer clothes";
Document document = Jsoup.connect(url).followRedirects(true).get();
However, the website it actually takes me to is http://www.sears.com/search=summer?.... effectively chopping off "clothes".
Why might this be the case? I've tried replacing the spaces in the URLs with %20's though this actually results in an error.
回答1:
They could be using JavaScript redirect.
来源:https://stackoverflow.com/questions/19023292/having-trouble-fetching-the-proper-site-in-java-second-word-for-website-search