提取数据java jsoup html

时间:2016-09-06 14:31:00

标签: java html css jsoup

我想提取文字"银行和信贷"来自链接http://ica-ap.coop/AboutUs/association-asian-confederation-credit-unions-accu

我尝试使用此代码:

    Document doc = Utils.getFromURL("http://ica-ap.coop/AboutUs/association-asian-confederation-credit-unions-accu");

    Elements e = doc.select("div.field-items div.field-item.even table[width=523]");    

    Element ab = e.select("thead tr td p").first();

    System.out.println(ab.text());

但它很有用。

有想法吗?

1 个答案:

答案 0 :(得分:0)

    Document doc = (Document) Jsoup.connect("http://ica-ap.coop/AboutUs/association-asian-confederation-credit-unions-accu").get();
    Elements e = doc.select("div.field-items div.field-item.even table[width=523]");    

    Element ab = e.select("tbody tr:nth-child(1) p").last(); //content is tbody not thead

    System.out.println(ab.text());