3pc 中文文档教程

发布于 9年前 浏览 33 项目主页 更新于 3年前

3pc

第三方网络内容数据库

What is it?

3pc 是CDN 和第三方跟踪服务列表的数据提供者。

灵感来自这篇 PerfPlanet 文章

Usage

3pc 构建为 nodejs 模块:

npm install 3pc

它提供“原始”数据和一些辅助函数:

var thirdParty = require('3pc');

// check if given URL is provided via Content Delivery Network
console.log(thirdParty.cdn.matchByUrl('http://example.com/foo.js'));
false

console.log(thirdParty.cdn.matchByUrl('http://vignette3.wikia.nocookie.net/nordycka/images/e/ee/Tj%C3%B8rnuv%C3%ADk.jpg/revision/latest/scale-to-width-down/640?cb=20150904165805&path-prefix=pl'));
Fastly

// check if given URL is not a tracking code
console.log(thirdParty.trackers.matchByUrl('http://edge.quantserve.com/quant.js'));
Quantcast

Data sources

3pc 当前使用以下数据源:

解析这些源并存储结果通过运行 Python 脚本在 ./db 目录中:

make generate

所以这个数据库可以被任何可以读取和解析 JSON 编码文件的技术使用。

3pc

Third party web content database

What is it?

3pc is meant to be a data-provider of CDN and 3rd party tracking services list.

Inspired by this PerfPlanet article.

Usage

3pc is built as nodejs module:

npm install 3pc

It provides "raw" data and some helper functions:

var thirdParty = require('3pc');

// check if given URL is provided via Content Delivery Network
console.log(thirdParty.cdn.matchByUrl('http://example.com/foo.js'));
false

console.log(thirdParty.cdn.matchByUrl('http://vignette3.wikia.nocookie.net/nordycka/images/e/ee/Tj%C3%B8rnuv%C3%ADk.jpg/revision/latest/scale-to-width-down/640?cb=20150904165805&path-prefix=pl'));
Fastly

// check if given URL is not a tracking code
console.log(thirdParty.trackers.matchByUrl('http://edge.quantserve.com/quant.js'));
Quantcast

Data sources

3pc is currently using the following data sources:

These sources are parsed and the result is stored in ./db directory by running a Python script:

make generate

So this database can be used by any technology that can read and parse JSON-encoded files.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文