更新时间:2023-12-03 21:31:22
通过其ID(应该是唯一的)获取父级div
:
Elements parent = doc.select("div#mw-body-content");
获取此元素中的所有p
标签(包括您想要的第二个标签):
Get all p
tags in this element (including the second one you would like to have):
Elements paragraphs = parent.getElementsByTag("p");
取第二个:
Take the second of it:
String text = paragraphs.get(1).text();