Skip to content

A fast and easy adblockplus parser and matcher based on adblock-rust package

License

Notifications You must be signed in to change notification settings

Intsights/braveblock

Repository files navigation

Logo

A fast and easy adblockplus parser and matcher based on adblock-rust package

license Python OS Build PyPi

Table of Contents

About The Project

This library is a Python binding to the adblock-rust library that was written by Brave's browser team. The binding uses pyo3 to interact with the rust package.

Built With

Installation

pip3 install braveblock

Usage

import braveblock


# Initialize the engine loaded with a rules list
# One can download easylist and load its lines into the engine
braveblock.Adblocker(
    rules=[
        "-advertisement-icon.",
        "-advertisement/script.",
    ]
)

# This function checks whether the specified url should be blocked
adblocker.check_network_urls(
    url="http://example.com/-advertisement-icon.",
    source_url="http://example.com/helloworld",
    request_type="image",
)

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Gal Ben David - gal@intsights.com

Project Link: https://github.com/intsights/Braveblock