网页视频抓取(Fathom教程视频-想象成一种微型编程语言,js框架 )
优采云 发布时间: 2022-02-27 07:06网页视频抓取(Fathom教程视频-想象成一种微型编程语言,js框架
)
Fathom 教程视频
官方网址:
GitHub:
介绍说明:网页内容提取的js框架
FaFathom 是一个用于 DOM API 的 JavaScript 框架,用于从网页中提取和识别弹出窗口、按钮、表单、文本内容和其他内容。
Fathom 用途:
将 Fathom 视为一种微型编程语言,它通过其程序 Fathom 规则集来识别 DOM 树的重要部分。
const rules = ruleset(
// Give any title tag the (default) score of 1, and tag it as title-ish:
rule(dom('title'), type('titley')),
// Give any OpenGraph meta tag a score of 2, and tag it as title-ish as well:
rule(dom('meta[property="og:title"]'), type('titley').score(2)),
// Take all title-ish things, and punish them if they contain
// navigational claptrap like colons or dashes:
rule(type('titley'), score(fnode => containsColonsOrDashes(fnode.element) ? .5 : 1)),
// Offer the max-scoring title-ish node under the output key "title":
rule(type('titley').max(), out('title'))
);