Jsoup抓取到页面A标签中的href路径

【Jsoup抓取到页面A标签中的href路径】博客地址:博客地址
直接上代码,注释很全乎

public static void main(String[] args)throws Exception{ //抓取的网址 String url = "http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2017/index.html"; //编码格式的转换 Document document = Jsoup.parse(new URL(url).openStream(), "GBK", url); //根据class获取到 页面的 元素内容 Elements tables = document.getElementsByClass("provincetr"); //根据td标签来划分 Elements td = tables.select("td"); for(int j=0; j

org.jsoup jsoup 1.11.3

需要引入以上jar包
也可以去这个网址下载,
输出的时候会抓到""空字符串,大家自己判断下就好了

    推荐阅读