| LEFT | RIGHT | 
|---|
| 1 # python-abp | 1 # python-abp | 
| 2 | 2 | 
| 3 This repository contains a library for working with Adblock Plus filter lists | 3 This repository contains a library for working with Adblock Plus filter lists | 
| 4 and the script that is used for building Adblock Plus filter lists from the | 4 and the script that is used for building Adblock Plus filter lists from the | 
| 5 form in which they are authored into the format suitable for consumption by the | 5 form in which they are authored into the format suitable for consumption by the | 
| 6 adblocking software. | 6 adblocking software. | 
| 7 | 7 | 
| 8 ## Installation | 8 ## Installation | 
| 9 | 9 | 
| 10 Prerequisites: | 10 Prerequisites: | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 92 update the filter lists incrementally, instead of downloading a new copy of a | 92 update the filter lists incrementally, instead of downloading a new copy of a | 
| 93 full list during each update. This is meant to lessen the amount of resources | 93 full list during each update. This is meant to lessen the amount of resources | 
| 94 used when updating filter lists (e.g. network data, memory usage, battery | 94 used when updating filter lists (e.g. network data, memory usage, battery | 
| 95 consumption, etc.), allowing clients to update their lists more frequently using | 95 consumption, etc.), allowing clients to update their lists more frequently using | 
| 96 less resources. | 96 less resources. | 
| 97 | 97 | 
| 98 Python-abp contains a script called `fldiff` that will find the diff between the | 98 Python-abp contains a script called `fldiff` that will find the diff between the | 
| 99 latest filter list, and any number of previous filter lists: | 99 latest filter list, and any number of previous filter lists: | 
| 100 | 100 | 
| 101     $ fldiff -o diffs/easylist easylist.txt archive/* | 101     $ fldiff -o diffs/easylist easylist.txt archive/* | 
|  | 102 | 
| 102 where `-o diffs/easylist` is the (optional) output directory where the diffs | 103 where `-o diffs/easylist` is the (optional) output directory where the diffs | 
| 103 should be written, `-l easylist.txt` is the most recent version of the | 104 should be written, `easylist.txt` is the most recent version of the filter list, | 
| 104 filter list, and `archive/*` is the directory where all the the archived filter | 105 and `archive/*` is the directory where all the archived filter lists are. When | 
| 105 lists are. When called like this, the shell should automatically expand the | 106 called like this, the shell should automatically expand the `archive/*` | 
| 106 `archive/*` directory, giving the script each of the files separately. | 107 directory, giving the script each of the filenames separately. | 
| 107 | 108 | 
| 108 The output of each `list[version].txt` will be written to | 109 In the above example, the output of each archived `list[version].txt` will be | 
| 109 `diffs/diff[version].txt`. The output argument is optional. If ommitted, the | 110 written to `diffs/diff[version].txt`. If the output argument is omitted, the | 
| 110 diffs will be written to the current directory. | 111 diffs will be written to the current directory. | 
| 111 | 112 | 
| 112 The script produces three types of lines, as specified in the [technical | 113 The script produces three types of lines, as specified in the [technical | 
| 113 specification][5]: | 114 specification][5]: | 
|  | 115 | 
| 114 * Special comments of the form `! <name>:[ <value>]` | 116 * Special comments of the form `! <name>:[ <value>]` | 
| 115 * Added filters of the form `+ <filter-text>` | 117 * Added filters of the form `+ <filter-text>` | 
| 116 * Removed filters of the form `- <filter-text>` | 118 * Removed filters of the form `- <filter-text>` | 
| 117 | 119 | 
| 118 | 120 | 
| 119 ## Library API | 121 ## Library API | 
| 120 | 122 | 
| 121 Python-abp can also be used as a library for parsing filter lists. For example | 123 Python-abp can also be used as a library for parsing filter lists. For example | 
| 122 to read a filter list (we use Python 3 syntax here but the API is the same): | 124 to read a filter list (we use Python 3 syntax here but the API is the same): | 
| 123 | 125 | 
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 206 | 208 | 
| 207 Now you can use the functions with `abp$functionname`, e.g. | 209 Now you can use the functions with `abp$functionname`, e.g. | 
| 208 `abp.line2dict("@@||g.doubleclick.net/pagead/$subdocument,domain=hon30.org")` | 210 `abp.line2dict("@@||g.doubleclick.net/pagead/$subdocument,domain=hon30.org")` | 
| 209 | 211 | 
| 210 | 212 | 
| 211  [1]: https://adblockplus.org/filters#special-comments | 213  [1]: https://adblockplus.org/filters#special-comments | 
| 212  [2]: http://pytest.org/ | 214  [2]: http://pytest.org/ | 
| 213  [3]: https://tox.readthedocs.org/ | 215  [3]: https://tox.readthedocs.org/ | 
| 214  [4]: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt | 216  [4]: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt | 
| 215  [5]: https://docs.google.com/document/d/1SoEqaOBZRCfkh1s5Kds5A5RwUC_nqbYYlGH72s
     bsSgQ/ | 217  [5]: https://docs.google.com/document/d/1SoEqaOBZRCfkh1s5Kds5A5RwUC_nqbYYlGH72s
     bsSgQ/ | 
| LEFT | RIGHT | 
|---|