Automated scripts to support converting filter lists (in various formats) to "domain-only" lists for use in DNS / domain-blocking tools like Pi-Hole.
For normal users:
You do not need to run these scripts yourself if you just want the resulting blocklists. The link above has the automatically-updated output of this script for many common / popular lists.
If you have a blocklist you'd like added, open a new issue here.
For advanced users:
If you'd like to run these scripts yourself, you can clone this git repository or download the following 3 files:
- buildrepo.py (optional, used to build the list-hosting repo you see at: justdomains/blocklists)
- Python 3.3+
- requests 2.18+
Download and convert a series of lists (provided by
lists.json) to a "domains-only" format.
This script outputs only the full-domain-blocking entries from the original lists, while attempting to filter any domains that conflict with an exception rule on the original list, thus creating output files that are useful in DNS / domain-blocking tools.
Supported input list formats: Adblock Plus Filter, HOSTS file
./convertlists.py lists.json converted/
(Will convert the lists specified by
lists.json, and output files into the folder
As input, convertlists.py requires the path to a
lists.json file, which contains an array of dictionaries describing each list.
The required dictionary keys / values for each list are:
|"name"||the list name (string)|
|"url"||the URL from which the list will be downloaded (http://, https://), or a local file:// url (string)|
|"format"||the format of the list (string; possible values: "adbp", "hosts")|
Optional dictionary keys / values for each list are:
|"license"||used to supply a license URL or description, if no license information can be extracted from the list itself (string)|
|"license-identifier"||a short license name / title (ex. "GPL3", "MIT")|
|"outputfile"||the base filename used for both the downloaded original and the converted output file (string) - important if multiple downloaded lists have the same filename|