简体   繁体   English

使用Jsoup提取表数据

[英]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. 我想提取赔率表http://www.oddsportal.com/soccer/italy/serie-a-2013-2014/ac-milan-sassuolo-4SwFEf0G/上赔率表的一些值,但是我已经成功了。 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. 如果有人可以帮助我找回开始和结束的赔率,也可以加号,您可以通过将鼠标悬停在赔率上来访问。

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. 停用JavaScript,该表将不会出现,因为它是使用JavaScript插入的。 Jsoup doesn't execute JavaScript. Jsoup不执行JavaScript。 You can only access elements that are contained in the code(html) of the website. 您只能访问网站的代码(html)中包含的元素。

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. 如果可以找到所插入数据的源(可能使用了ajax),也许可以检索数据,但是在这种情况下,仅使用jsoup是行不通的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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