标签:splay isp reac 相对 foreach 绝对路径 lan attr eval
val urlList = Jsoup.parse(html,"https://www.jianshu.com/").getElementsByAttributeValue("target","_blank").select(".title")
println(urlList)
println(htmlPage.getBaseURL)
urlList.forEach(
// Element:
x => {
println(x.absUrl("href"))
println(x.absUrl("abs:href"))
}
)
def getContentUrls: List[URL] = {
val listBuffer = new ListBuffer[URL]
val urlList = Jsoup.parse(html).select("""a[href~=.*?.html]""")
urlList.foreach(x => {
val url = new URL (x.attr("abs:href")) // 获取元素A Element 的绝对路径信息
logger.info("获取URL的绝对路径信息: " + url)
listBuffer += url
})
listBuffer.toList
}
标签:splay isp reac 相对 foreach 绝对路径 lan attr eval
原文地址:https://www.cnblogs.com/duchaoqun/p/12755008.html