android - 在 div 中解析跨度

标签 android jsoup

您好,我是 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/

相关文章:

java - 从 Google Fit API 获取数据时不显示瞬时读数

java - Android 中的 Fragments 和 ViewPager

java - Android - 创建进度对话框

java - JSoup 字符编码问题

java - JSoup 数据问题

java - 使用 jsoup 的网络爬虫

android - 找不到符号类 AutocompletePrediction

android - 存储访问框架持久权限不起作用

java - Jsoup 解析 RSS 时出现错误?

java - 如何在select中找到n的值