【发布时间】:2014-09-26 17:17:53
【问题描述】:
原始网址:http://pricecheckindia.com/go/store/ebay/52440?ref=velusliv
重定向网址:http://www.ebay.in/itm/Asus-Zenfone-6-A600CG-A601CG-White-16-GB-/111471688863?pt=IN_Mobile_Phones&aff_source=DA
我需要一个程序来获取original url 并打印redirected url。
如何在 java 中完成这项工作。
public static void main(String[] args) throws IOException, InterruptedException
{
String url = "http://pricecheckindia.com/go/store/ebay/52440?ref=velusliv";
Response response = Jsoup.connect(url).followRedirects(false).execute();
System.out.println(response.url());
}
【问题讨论】:
-
在 jsoup 中尝试了一些东西......但没有做对