您好,我是 JSOUP 的新手,我需要检索一个跨度值。 这是我的 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();
但它没有检索到我想要的内容。你能帮忙吗?
最佳答案
使用这个(已编辑)
使用 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());
}
关于android - 在 div 中解析跨度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33752238/