Napster
Napster

Reputation: 1

Using Jsoup to extract table data

I want to extract some of the values of the table of odds on oddsportal http://www.oddsportal.com/soccer/italy/serie-a-2013-2014/ac-milan-sassuolo-4SwFEf0G/ but I have been successful. I've tried

Elements stats2 = document2.select("table.detail-odds");
for(Element spec : stats2 ){
                    for(Element row : spec.select("tr")){
                        Elements tds = row.select("td");
                        System.out.print(tds);

}}

and it returns nothing.

Also a plus mark if someone can help me retrieve the opening and ending odds which you can access by hovering your mouse over the odds.

Upvotes: 0

Views: 242

Answers (1)

fabian
fabian

Reputation: 82461

There is no such table on the website (in its original state).

Deactivate JavaScript and the table will not appear, since it's inserted using JavaScript. Jsoup doesn't execute JavaScript. You can only access elements that are contained in the code(html) of the website.

If you can find the source of the data that is inserted (likely ajax is used), maybe you can retrieve the data, but simply using jsoup won't work in this case.

Upvotes: 1

Related Questions