简体   繁体   中英

JSOUP. How to extract data with select on this page?

Hello I'm new using "jsoup" And tried to extract data from this page but for more that I combine the "id" and "class" does not show me anything.

enter image description here

The code is this:

 Document d = getHtmlDocument("http://www.mismarcadores.com/futbol/inglaterra/league-one/resultados/"); 
 System.out.println("El Status Code  es: "+getStatusConnectionCode("http://www.mismarcadores.com/futbol/inglaterra/league-one/resultados/"));

Elements ele=d.select("#fs-results");
System.out.println("Numero de entradas en la pagina mismarcadores: "+ele.size()+"\n");

With other pages if it extract your information.

Thanks.....

I believe you'll be after something like this:

Element element = d.getElementById("fs-results");

or

Elements elements = d.getElementsByClass("fs-table");

The tag that contains data for this page is <div id="tournament-page-data-results">. This code will get you that data. However, the format of the data is very strange to me and I am not able to help with that. Sometimes to find the data, right-click on the page in a browser, "view source code", look through the source code and identify the tag with the data.

Document d = Jsoup.connect(url).get();
//Option 1.
Element element = d.getElementById("tournament-page-data-results");
System.out.println(element.text());
//Option 2 with select.
Elements element2 = d.select("#tournament-page-data-results");
System.out.println(element2.get(0).text());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM