获取百度的真实地址信息

public String getRealUrlFromBaiduUrl(String url) {
    Connection.Response res = null;
    int itimeout = 60000;
    try {
        res = Jsoup.connect(url).timeout(itimeout).method(Connection.Method.GET).followRedirects(false).execute();
        return res.header("Location");
    } catch (IOException e) {
        e.printStackTrace();
    }
    return "";
}

你可能感兴趣的:(JAVA)