项目
在 GitHub 查看
wrtnlabs/web-content-extractor
关于
A LLM-free library for extracting main content from HTML strings via Text Density analysis
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- -2
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文web-content-extractor
A small and fast library for extracting content from HTML.
It is an one of implementation of the paper DOM Based Content Extraction via Text Density.
Installation
To install via NPM:
npm i @wrtnlabs/web-content-extractor
Usage
import { extractContent } from "@wrtnlabs/web-content-extractor";
const { title, description, content, contentHtmls, links } =
extractContent(html);
console.log("title", title);
console.log("description", description);
console.log("content", content); // The content of the page; string
for (const fragment of contentHtmls) {
console.log("fragment", fragment); // The fragment of the content; string
}
for (const link of links) {
console.log("url", link.url); // The URL of the link
console.log("content", link.content); // The content of the link
}
Note
It strips some tags that can be considered as non-content tags, including:
scriptnoscriptstylenavheaderfooterimgsvgvideoaudioformlabelinputselectoptionbuttonobjectembediframecanvasmaparea
探索相关项目
加载中…