【发布时间】:2019-05-02 16:28:34
【问题描述】:
我正在使用 Jsoup 库通过选择其中包含“nav”字符串的类属性来抓取网页。
这是获取网站 HTML 的代码:
var bodyString = Jsoup.connect(url)
.ignoreContentType(true)
.userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0")
.timeout(12000)
.followRedirects(true)
.execute()
.body();
如你所见,id="varPreviewMenu" 的 ul 元素包含 Jsoup 检索的 HTML 不包含的 li 元素。
我怎样才能得到这些元素?
【问题讨论】:
-
这个答案的第一部分适用于你的问题stackoverflow.com/questions/54505676/jsoup-hidden-div-class/…