Brave Ad Block
Native node module, and C++ library for Adblock Plus filter parsing for lists like EasyList.
It uses a bloom filter and Rabin-Karp algorithm to be super fast.
Compatibility
This project supports almost all of the EasyList rule formats. It also supports some rule formats specific to other projects, like uBlock and AdGuard. For more details on what rule formats are supported, please see compatibility wiki page.
To include brave/ad-block in your project:
npm install --save ad-block
JS Sample
const AdBlockClient FilterOptions = const client = clientclientvar b1 = clientvar b2 = clientconsoleconsole
C++ Sample
string void int
Util for checking URLs
- Basic checking a URL:
node scripts/check.js --host www.cnet.com --location https://s0.2mdn.net/instream/html5/ima3.js
- Checking a URL with discovery:
node scripts/check.js --host www.cnet.com --location "https://slashdot.org?t=1&ad_box_=2" --discover
- Checking a URL against a particular adblock list:
node scripts/check.js --uuid 03F91310-9244-40FA-BCF6-DA31B832F34D --host slashdot.org --location https://s.yimg.jp/images/ds/ult/toppage/rapidjp-1.0.0.js
- Checking a URL from a loaded DAT file:
node scripts/check.js --dat ./out/SafeBrowsingData.dat --host excellentmovies.net --location https://excellentmovies.net
- Checking a list of URLs:
node scripts/check.js --host www.cnet.com --list ./test/data/sitelist.txt
- Checking a list of URLS with discovery:
node scripts/check.js --host www.cnet.com --list ./test/data/sitelist.txt --discover
Developing brave/ad-block
-
Clone the git repository from GitHub:
git clone --recursive https://github.com/brave/ad-block
-
Open the working directory:
cd ad-block
-
Install the Node (v5+) dependencies:
npm install
-
Install ninja: ##### MAC brew install ninja
##### WINDOWS
Go to the releases page of the Ninja build tool, and download a suitable binary for Windows. Place ninja.exe in a suitable spot. For example, C:\Ninja. Now make sure that CMake can find ninja.exe by adding C:\Ninja to your %PATH%.
Make the node module
make
Running sample (which also generates a .dat file for deserializing)
make sample
Running tests
make test
Clearing build files
make clean