共计 866 个字符,预计需要花费 3 分钟才能阅读完成。
低代码,高效而简洁;支持正则表达式,复杂的场景也能很容易提取数据。
- 支持: Nodejs, TypeScript
- 依赖: Cheerio, turndown
- HTML 代码片段可以转 Markdown
使用 YAML 来配置解析,可高效管理输出 JSON 结构
以下是最简单的解析形态,有个更复杂 SERP 例子在 git 中可作为学习参考。
YAML 配置
tree:
nodes:
title:
selector: title
body:
selector: body
attr: html
to_markdown: true
HTML
Cheerio Tree
Cheerio Tree
What is Cheerio Tree?
Cheerio Tree is a powerful utility built on Cheerio, designed for efficient DOM parsing. It enables rapid conversion of HTML data into JSON format. When paired with YAML, it provides an intuitive and streamlined approach to data handling and transformation.
输出
{
"title":"Cheerio Tree",
"body":"Cheerio Treen============nnWhat is Cheerio Tree?n---------------------nn**Cheerio Tree** is a powerful utility built on **Cheerio**, designed for efficient DOM parsing. It enables rapid conversion of HTML data into JSON format. When paired with YAML, it provides an intuitive and streamlined approach to data handling and transformation."
}
正文完