Jsoup 示例:打印 URL 的链接

2024年8月29日 | 1 分钟阅读

在本例中,我们将打印 URL 的总链接。为此,我们将调用 Document 类的 select() 方法,该方法返回 Elements 的引用。 Elements 类具有可以通过 for-each 循环遍历的元素。 Element 类提供 attr() 和 text() 方法来返回链接的链接和文本。

输出

link : https://tpointtech.cn/contribute-us
text : Contribute Us

link : https://tpointtech.cn/asknewquestion.jsp
text : Ask Question

link : https://tpointtech.cn/login.jsp
text : login

.....