在div中解析跨度

时间:2015-11-17 08:28:46

标签: android jsoup

嗨,我是JSOUP的新手,我需要检索一个span值。 这是我的html来源:

  <div class=" exactCenterlabel" style="font-size: xx-large">
 <span id="labelfriends" style="display:inline-block;border-style:Outset;font-family:Guttman Yad-Brush;font-size:50pt;font-weight:bold;font-style:italic;height:115px;width:868px;margin-bottom: 0px">!תכיר מי הם החברים שלך </span> 
</div>

我试过这个String value = doc.select("span#labelfriends").text();

但它没有找到我想要的东西。你能帮忙吗?

1 个答案:

答案 0 :(得分:2)

使用此(已编辑)
使用http://109.67.102.212:90/作为您的网址,而不是http://knowyourfriend.ddns.net/,因为它在内部从框架中调用http://109.67.102.212:90/

public static void main(String[] args) throws IOException {
    Document doc = Jsoup.connect("http://109.67.102.212:90/").timeout(10000)
                .userAgent("Mozilla/5.0")
                .get();
    System.out.println(doc.select("div.exactCenterlabel").select("span#labelfriends").text());
 }