Giving an url, that redirected is a url with spaces, to Jsoup leads to an error. How resolve this?

后端 未结 2 779
小蘑菇
小蘑菇 2020-12-11 10:16

Hello I have to parse pages wich URI is resolved by server redirect.

Example:

I have http://www.juventus.com/wps/poc?uri=wcm:oid:91da6dbb-4089-49c0-a1df-3a56

2条回答
  •  渐次进展
    2020-12-11 10:55

    Try this Instead

    String url = "http://www.juventus.com/wps/wcm/connect/JUVECOM-IT/news/primavera%20convocati%20villar%20news%2010agosto2013";
            Document doc = Jsoup.connect(url)
            .data("pragma", "no-cache")
            .get();
    
            Element img = doc.select(".juveShareImage").first();
    
            String imgurl = img.absUrl("src");
            System.out.println(imgurl);
    

提交回复
热议问题