我需要的是从url
. 例如,从http://beechplane.wordpress.com/之类的链接,我需要收集包含实际文章的链接。即,像http://beechplane.wordpress.com/2012/11/07/the-95-confidence-of-nate-silver/,http://beeechplane.wordpress.com/2012/03/06/visualizing 之类的链接-概率轮盘赌/等。
如何在 Java 中获取这些链接?是否可以使用网络爬虫?
我需要的是从url
. 例如,从http://beechplane.wordpress.com/之类的链接,我需要收集包含实际文章的链接。即,像http://beechplane.wordpress.com/2012/11/07/the-95-confidence-of-nate-silver/,http://beeechplane.wordpress.com/2012/03/06/visualizing 之类的链接-概率轮盘赌/等。
如何在 Java 中获取这些链接?是否可以使用网络爬虫?
我为此使用jsoup库。
如何<a>
从文档中获取所有标签:
Elements a = doc.select("a");
for (Element el : a) {
//process element
String href = el.attr("href");
}