Registry / devops / adblockparser

adblockparser

JSON →
library0.7pypypiunverified

A Python library to parse Adblock Plus rules and check if URLs match them. The current version is 0.7, with low release cadence (last release in 2018). It is considered stable but in maintenance mode.

pip install adblockparser
INSTALL
IMPORT
SIG · ADBLOCKPARSER
A
adblockparser
devopspythonv0.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AdblockRuleParser
from adblockparser import AdblockRuleParser

Create a parser from a list of Adblock Plus rule strings and check URLs.

from adblockparser import AdblockRuleParser rules = ['||example.com^', '@@||example.com/notrack$image'] parser = AdblockRuleParser(rules) # Check if a URL matches any blocking rule (options can be passed as dict) options = {'third-party': True, 'script': True} result = parser.should_block('http://example.com/ad.js', options) print(result) # True or False
Debug
Known issues
gotchaAdblockRuleParser requires options dict for matching – if omitted, `should_block` may not work correctly because it defaults to no option restrictions, making it overly aggressive or not matching correctly.
fix
Always pass an options dict (e.g., {'third-party': False}). If you don't need options, use an empty dict {} – but be aware that rules depending on options won't be applied.
affects: >=0.1
deprecatedThe library is in maintenance mode with no active development. It has not been updated since 2018 and may not support newer Adblock Plus rule syntax (e.g., extended CSS, procedural filters).
fix
Consider alternatives like `adblockclient` or implement custom parsing for newer rules.
affects: 0.7
gotchaMatching options are case-sensitive and must match the usage in rules (e.g., 'third-party' vs 'thirdParty'). Incorrect casing leads to silent failures.
fix
Use all lowercase option keys: 'domain', 'third-party', 'script', 'image', 'stylesheet', 'object', 'subdocument', 'xmlhttprequest', 'other'.
affects: >=0.1
Upgrade
Version history
0.7latest on PyPI · released Oct 17, 2016
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
30
OpenAI (training)
1
Resources
adblockparser — pip install adblockparser · libregistry