ArniDagur / python-adblock

Brave's adblock library in Python
https://pypi.org/project/adblock/
Apache License 2.0
57 stars 5 forks source link

Doesn't correctly parse script injections #69

Closed alkim0 closed 2 years ago

alkim0 commented 2 years ago

To take a minimal example:

import adblock

filter_set = adblock.FilterSet()
filter_set.add_filters(["example.com##+js(nobab)"], "standard")
engine = adblock.Engine(filter_set)
print(engine.url_cosmetic_resources("https://example.com"))

I expect the returned cosmetic_resources.injected_script to have a value, but instead I get:

UrlSpecificResources<0 hide selectors, 0 style selectors, 0 exceptions, injected_javascript='', generichide=False>

This seems incredibly strange to me, since I thought this library was mostly a wrapper around the original Rust library.

I'm using version 0.5.2-1 on ArchLinux.

alkim0 commented 2 years ago

Nevermind. I think this is because I didn't add any javascript resources to the engine.