ContentExtractor 网页正文抽取算法开源项目

我要开发同款
匿名用户2014年11月03日
27阅读
开发技术Java
所属分类常用工具包、程序开发、其他开发相关
授权协议GPLv2

作品详情

简介

ContentExtractor是一个开源的网页正文抽取工具,用JAVA实现,具有非常高的抽取精度。

项目地址转移

项目已和WebCollector合并,当前项目为老版本ContentExtractor,请前往WebCollector项目查看ContentExtractor的最新版本源码和API。

教程(只适用于老版本,新版本请前往WebCollector)

ContentExtractor的接口非常简单,用户可以根据网页的url,或者网页的html,来进行网页正文抽取:

根据url,抽取网页的正文:

public static void main(String[] args) throws Exception {        String content=ContentExtractor.getContentByURL("https://news.            xinhuanet.com/world/2014-11/02/c_127166728.htm");        System.out.println(content);}

根据html,抽取网页的正文:

public static void main(String[] args) throws Exception {        String html="获取到的html源码";        String content=ContentExtractor.getContentByHtml(html);        System.out.println(content);}

导入项目(只适用于老版本,新版本请前往WebCollector)

从ContentExtractor的github主页https://github.com/hfut-dmic/ContentExtractor上下载ContentExtractor-{版本号}-bin.zip,将解压后得到的jar包全部放到工程的buildpath即可。

ContentExtractor由合肥工业大学dmic团队开发

Git@OSC:https://git.oschina.net/webcollector/ContentExtractor

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论