ghostery/adblocker
关于
高效且可嵌入的广告拦截库
安全与隐私实测星标增长
- 24小时
- 0
- 7天
- +3
- 15天
- +1
- 1个月
- +5
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Adblocker
Efficient
· Minimal
· JavaScript
· TypeScript
· uBlock Origin- and Easylist-compatible
Node.js
· Puppeteer
· Electron
· WebExtension
The Ghostery adblocker is a JavaScript library for blocking ads, trackers, and annoyances with a strong focus on efficiency. It was designed with compatibility in mind and integrates seamlessly with the following environments:
- Block ads in Puppeteer,
- Block ads in Electron,
- Block ads in Chrome and Firefox,
- Or as a standalone JavaScript library.
Getting Started
The Ghostery adblocker is the easiest and most efficient way to block ads and trackers in your project. Only a few lines of code are required to integrate smoothly with Puppeteer, Electron, a Chrome- and Firefox-compatible browser extension, or any environment supporting JavaScript (e.g. Node.js or React Native).
Here is how to do it in two steps for a Chrome- and Firefox-compatible WebExtension:
- Install:
npm install --save @ghostery/adblocker-webextension - Add the following in your background script:
import { WebExtensionBlocker } from '@ghostery/adblocker-webextension';
WebExtensionBlocker.fromPrebuiltAdsAndTracking().then((blocker) => {
blocker.enableBlockingInBrowser(browser);
});
Congratulations, you are now blocking all ads and trackers! :tada:
Compatibility
The library supports 99% of all filters from the Easylist and uBlock Origin projects. Check the compatibility matrix on the wiki for more details.
Contributing
This project makes use of lerna and yarn workspaces under the hood. Quickly get started with:
- Fork and clone the repository,
- Enable corepack:
corepack enable, - Install dependencies:
yarn install --immutable, - Build:
yarn build, - Test:
yarn test.
For any questions, feel free to open an issue or a pull request to get some help!
Who is using it?
This library is the building block technology used to power the adblockers from Ghostery and Cliqz on both desktop and mobile platforms. It is already running in production for millions of users and has been battle-tested to satisfy the following use-cases:
- Mobile-friendly adblocker in react-native, WebExtension, or custom JavaScript context: Ghostery for iOS.
- Ads and trackers blocker in Electron applications, Puppeteer headless browsers, Cliqz browser, ghostery and standalone).
- Batch requests processing in Node.js, HTML fuzzy keyword matcher, and more.
The innovative algorithms and architecture designed and implemented in this project have been shown to be among the most efficient ways to implement ad-blockers and have been used in other projects to implement highly performant adblockers such as Brave.
Swag
Show the world you're using ghostery/adblocker →
[](https://github.com/ghostery/adblocker)
Or HTML:
<a href="https://github.com/ghostery/adblocker/" target="_blank" rel="noopener noreferrer">
<img alt="powered by Ghostery" src="https://img.shields.io/badge/ghostery-powered-blue?logo=ghostery">
</a>
License
探索相关项目
加载中…