HTML 正文内容提取库 Crux

码农软件 · 软件分类 · 机器学习/深度学习 · 2019-08-05 21:59:47

软件介绍

Crux 是一个 HTML 正文内容提取库,它通过分析 Web 页面,以确定一篇文章的关键内容。该库由多个独立的 API 组成,可随意选择想使用的那个。比如说,如果你在 Android 应用中使用 Crux ,则可以使用 Proguard 或其他压缩工具来去除不需要的部分。

文章提取 API :

  • 可格式化提取内容丰富,不限于纯文本。

  • 支持更多的网站和更好的页面整体解析。

  • 支持更多的元数据格式:OpenGraph, Twitter Cards,Schema.org 等

  • 占用空间小,JSoup 是唯一需要的依赖项。

  • 更少的 setters/getters,简单易用

  • 能够使用默认的 HttpUrlConnection 之外的 HTTP 库,例如 OkHttp 。

  • 代码简洁

  • 高度支持通过 Gradle 导入 Android Studio 项目

  • 持续集成单元测试和 golden file 测试。

示例代码:

在后台线程中,发出网络请求并获取想要分析的页面的 rawHTML 。

String url = "https://example.com/article.html";
String rawHTML = "<html><body><h1>This is an article</h1></body></html>";

Article article = ArticleExtractor.with(url, rawHTML)
    .extractMetadata()
    .extractContent()  // If you only need metadata, you can skip `.extractContent()`
    .article();

在 UI 线程上:

// Use article.document, article.title, etc.

本文地址:https://codercto.com/soft/d/11732.html

Introduction to Computer Science Using Python

Introduction to Computer Science Using Python

Dierbach, Charles / 2012-12 / $ 133.62

Introduction to Computer Science Using Python: A Computational Problem-Solving Focus introduces students to programming and computational problem-solving via a back-to-basics, step-by-step, objects-la......一起来看看 《Introduction to Computer Science Using Python》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

html转js在线工具
html转js在线工具

html转js在线工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具