package parser; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import spider.HttpConnectionManager; /** test * @author lidongyang * @createtime Oct 23, 2012 11:05:33 AM */ public class GetQqNews { public static void main(String[] args){ HttpConnectionManager httpConnectionManager = new HttpConnectionManager(); String html = httpConnectionManager.getHtml("http://www.qq.com"); Document doc = Jsoup.parse(html); Elements newsList = doc.select("[class=ft fl]").select("ul").select("li").select("a"); for (Element element : newsList) { System.out.println(element.attr("href") + "----" + element.text()); } } }

zdm1231 LV2
2022年1月7日
guodaxia LV14
2020年8月31日
a934883425 LV1
2020年6月24日
tfd280620913 LV1
2020年5月18日
BigBull LV1
2020年4月28日
958331502 LV1
2020年4月27日
xiaobai145 LV10
2020年2月15日
wei112233 LV15
2020年2月2日
sleepcat88 LV13
2020年1月20日
多多像小羊 LV1
2019年11月22日

taoshen95 LV16
2022年11月17日
12cq345 LV6
2022年11月15日
sunlea LV20
2022年9月8日
whfuai LV14
2022年5月9日
zdm1231 LV2
2022年1月7日
DeepLoveDeep LV2
2021年11月23日
NRLeaf
2021年7月13日
暂无贡献等级
Sean_admin LV7
2021年4月28日
wx929058456
2021年3月23日
暂无贡献等级
wwkddjjj LV8
2021年3月23日