htmlparser中獲取網(wǎng)頁(yè)超鏈接的兩種方法
方法一:
方法二:
URL url = new URL(pageUrl);
URLConnection conn = url.openConnection();
parser = new Parser(conn);
URLConnection conn = url.openConnection();
parser = new Parser(conn);
NodeList list = parser.parse(new TagNameFilter("a"));
方法二:
HTMLLinkBean htmlLinkBean = new HTMLLinkBean();
htmlLinkBean.setURL("http://www.sohu.com");
URL[] urls = htmlLinkBean.getLinks();
htmlLinkBean.setURL("http://www.sohu.com");
URL[] urls = htmlLinkBean.getLinks();
posted on 2012-08-22 18:33 小一敗涂地 閱讀(1486) 評(píng)論(0) 編輯 收藏 所屬分類: 開源工具、插件相關(guān) 、lucene、solr等搜索技術(shù)相關(guān)