微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Fathom

编程之家收集整理的这个编程导航主要介绍了Fathom编程之家,现在分享给大家,也给大家做个参考。

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 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'))

);

网站地址:http://mozilla.github.io/fathom/

GitHub:https://github.com/mozilla/fathom

网站描述:从网页中提取内容的js框架

Fathom

官方网站:http://mozilla.github.io/fathom/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。