如何使用jsoup获取信息
How to get information using jsoup
我有这个html
<td rowspan="3" class="event start"> <a href="/search/1065650;1/note">INFO1<br>DETAIL1 DETAIL2<br>INFO2</a> </td>
如何使用 jsoup 获取 INFO1 和 INFO2?
尝试类似的方法:
Document doc = Jsoup.connect(url).get();
Elements td=doc.select("td.event.start");
Elements a = td.first().getElementsByTag("a");
String [] words = a.text().split(" ");
System.out.println(words[0]+" "+words[3]);
测试于:
<!doctype html>
<html>
<body>
<td rowspan="3" class="event start">
<a href="/search/1065650;1/note">
INFO1<br>DETAIL1 DETAIL2<br>INFO2
</a>
</td>
</body>
</html>
我有这个html
<td rowspan="3" class="event start"> <a href="/search/1065650;1/note">INFO1<br>DETAIL1 DETAIL2<br>INFO2</a> </td>
如何使用 jsoup 获取 INFO1 和 INFO2?
尝试类似的方法:
Document doc = Jsoup.connect(url).get();
Elements td=doc.select("td.event.start");
Elements a = td.first().getElementsByTag("a");
String [] words = a.text().split(" ");
System.out.println(words[0]+" "+words[3]);
测试于:
<!doctype html>
<html>
<body>
<td rowspan="3" class="event start">
<a href="/search/1065650;1/note">
INFO1<br>DETAIL1 DETAIL2<br>INFO2
</a>
</td>
</body>
</html>