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.
pip3 install braveblock
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",
)
Distributed under the MIT License. See LICENSE
for more information.
Gal Ben David - [email protected]
Project Link: https://github.com/intsights/Braveblock