Created
May 14, 2019 21:26
-
-
Save englehardt/6e0d1a96f32b9b58a2f6470b7c5a1b74 to your computer and use it in GitHub Desktop.
Example of how to use the DisconnectParser included in `trackingprotection_tools` (https://pypi.org/project/trackingprotection-tools/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from trackingprotection_tools import DisconnectParser | |
BLOCKLIST_URL = 'https://raw.githubusercontent.com/mozilla-services/shavar-prod-lists/master/disconnect-blacklist.json' # noqa | |
REMAPPING_URL = 'https://raw.githubusercontent.com/mozilla-services/shavar-list-creation/master/disconnect_mapping.json' # noqa | |
dc = DisconnectParser( | |
blocklist_url=BLOCKLIST_URL, | |
disconnect_mapping_url=REMAPPING_URL, | |
verbose=True | |
) | |
base_list = dc.get_domains_with_category( | |
['Analytics', 'Advertising', 'Social'] | |
) | |
print("Total number of rules on base list: %d" % len(base_list)) | |
content_list = dc.get_domains_with_category(['Content']) | |
print("Total number of rules on the strict list: %d" % len(content_list)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment