I would like to import data from this page through Mathematica,
http://www.oddsportal.com/soccer/netherlands/eredivisie/ .
I tried importing through the default Import function
d = Import["http://www.oddsportal.com/soccer/netherlands/eredivisie/","Data"[[3, 1, 1, 2]];
Select[d, ! StringFreeQ[#[[1]], " - "] &] // Quiet // TableForm
I got a simular table like this where all the interessting data is replaced by a '-'.
Heracles - Cambuur - - -
Willem II - AZ Alkmaar - - -
Heerenveen - Excelsior - - -
G.A. Eagles - Dordrecht - - -
Zwolle - Vitesse - - -
Breda - Twente - - -
Den Haag - Groningen - - -
Feyenoord - Utrecht - - -
Ajax - PSV - - -
I've been told this is because the webpage updates the data through a JavaScript, that fetches the information form a database. So is there a way of letting the webpage load it's data before importing it?
Futhermore, I found a solution for Windows users, where the webpage is loaded with Internet Explorer by NETLink. But since I mostly use a OSX machine, this won't work for me.
Needs["NETLink`"];
InstallNET[];
ie = CreateCOMObject["InternetExplorer.Application"];
ie@Navigate[
"http://www.oddsportal.com/soccer/netherlands/eredivisie/"];
Pause[3];
doc = ie@Document;
html = doc@body@innerHTML;
This made able to construct a table with all the data, after combing through the html code.
AZ Alkmaar - Ajax 2.96 3.47 2.26
Excelsior - G.A. Eagles 2.38 3.37 2.86
Utrecht - Willem II 2.19 3.4 3.16
Groningen - Heracles 1.7 4. 4.41
So again, is there a way of executing the JavaScript on a page before importing the data? Maybe through a JLink equivalent of the code above?