Elijah
Elijah

Reputation: 306

jsoup not fetching all images off a page

Tried to fetch images off this page.

Using code shown below it fetches only side images like their logo etc., but doesn't fetch the image in which they have shown data.

public static void main (String args[])
{   
    Document doc;
    try {       
        doc = Jsoup.connect("http://www.wolframalpha.com/input/?i=hepatitis").get();
        Elements desc =doc.select("img[src]");                               
        {
            for (Element link :desc)                
            System.out.println("text :"+link.absUrl("src"));
        }
    } catch (IOException e) {
        System.out.println(e);
    }  
}
}

I even tried to fetch images using their id like this:

Elements desc =doc.select("#scannerresult_0300_1 img[src]");

but it didn't return any result.

Upvotes: 0

Views: 707

Answers (1)

ollo
ollo

Reputation: 25350

The website generates lots of content based on javascripts. nfortunately Jsoup doesn't support those, so the scripts are not executed, therefore no content is generated.

Please see this answer for more informations: Fetch contents(loaded through AJAX call) of a web page

Upvotes: 1

Related Questions