Fathom 介绍
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 t hey contain
// navigational clap trap 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'))
);
网站地址 : http://mozilla.github.io/fathom/
GitHub: https://github.com/mozilla/fathom
网站描述: 从网页中 提取 内容 的js框架
Fathom官方网站
官方网站: http://mozilla.github.io/fathom/
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。