我正在尝试使用 jsoup 打印拉出“10 - 50”的文本,但我似乎无法正确拉出它。这是HTML代码:
<dd>
<time itemprop="datePublished">21 October 2012</time>
</dd>
<dt>
Current Version:
</dt>
<dd itemprop="softwareVersion">
1.0
</dd>
<dt itemprop="operatingSystems" content="Android">
Requires Android:
</dt>
<dd>
2.3.3 and up
</dd>
<dt>
Category:
</dt>
<dd>
<a href="xxx">Entertainment</a>
</dd>
<dt>
Installs:
</dt>
<dd itemprop="numDownloads">
10 - 50
<div class="normalized-daily-installs-chart" style="width: 105px;">
<img src="xxx" />
<p>last 30 days</p>
</div>
</dd>
<dt>
Size:
</dt>
<dd itemprop="fileSize">
12M
</dd>
我试过这段代码,但它打印“1.0 10 - 50 last 30 days 12M €0.69 Everyone”
import java.io.IOException;
import java.io.InputStream;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class googletest {
public static void main(String[] args) throws IOException {
Document doc = Jsoup
.connect("private url"
)
.get();
Elements spans = doc.select("dd[itemprop]");
System.out.println(spans.text());
}
}
我只是想单独打印字符串 10 - 50 没有其他值,谢谢。