| LEFT | RIGHT | 
|   1 # abp2blocklist |   1 # abp2blocklist | 
|   2  |   2  | 
|   3 This is a script to convert [Adblock Plus filter lists](https://adblockplus.org/
    filters) |   3 This is a script to convert [Adblock Plus filter lists](https://adblockplus.org/
    filters) | 
|   4 to [WebKit block lists](https://www.webkit.org/blog/3476/content-blockers-first-
    look/). |   4 to [WebKit block lists](https://www.webkit.org/blog/3476/content-blockers-first-
    look/). | 
|   5  |   5  | 
|   6 Note that WebKit content blockers are fairly limited. Hence, not all filters |   6 Note that WebKit content blockers are fairly limited. Hence, not all filters | 
|   7 can be converted (in a compatible way), and some differences compared to Adblock |   7 can be converted (in a compatible way), and some differences compared to Adblock | 
|   8 Plus for other browsers are expected. |   8 Plus for other browsers are expected. | 
|   9  |   9  | 
|  10 This script is used to convert the filter lists for |  10 This script is used to convert the filter lists for | 
|  11 [Adblock Plus for iOS](https://adblockplus.org/releases/adblock-plus-10-for-ios-
    released). |  11 [Adblock Plus for iOS](https://adblockplus.org/releases/adblock-plus-10-for-ios-
    released). | 
|  12  |  12  | 
 |  13 ## Requirements | 
 |  14  | 
 |  15 The required packages can be installed via [NPM](https://npmjs.org): | 
 |  16  | 
 |  17 ``` | 
 |  18 npm install | 
 |  19 ``` | 
 |  20  | 
 |  21 ### filterClasses.js | 
 |  22  | 
 |  23 The filterClasses module in `node_modules/filterClasses.js` is generated from | 
 |  24 the module in the `adblockpluscore` repository. It has been generated using | 
 |  25 JS Hydra, and small modifications made. If you need to re-generate the file run | 
 |  26 this command (adjusting the paths as appropriate): | 
 |  27  | 
 |  28 ``` | 
 |  29 python buildtools/jshydra/abp_rewrite.py adblockpluscore/lib/filterClasses.js | 
    grep -vi filterNotifier > ../abp2blocklist/node_modules/filterClasses.js | 
 |  30 ``` | 
 |  31 You will then need to remove any references to the `utils` module from the | 
 |  32 generated file by hand. | 
 |  33  | 
|  13  |  34  | 
|  14 ## Usage |  35 ## Usage | 
|  15  |  36  | 
|  16 ``` |  37 ``` | 
|  17 node abp2blocklist.js < easylist.txt > easylist.json |  38 node abp2blocklist.js < easylist.txt > easylist.json | 
|  18 ``` |  39 ``` | 
|  19  |  | 
|  20  |  | 
|  21 ## Requirements |  | 
|  22  |  | 
|  23 The `node_modules` directory contains the required Adblock Plus modules, already |  | 
|  24 converted to compatible JavaScript using JS Hydra. If for some reason you need |  | 
|  25 to re-generate these files you can do so by running the following commands from |  | 
|  26 the `adblockpluschrome` directory (assuming your abp2blocklist path is the same)
    : |  | 
|  27  |  | 
|  28 ``` |  | 
|  29 python buildtools/jshydra/abp_rewrite.py lib/punycode.js > ../abp2blocklist/adbl
    ockplus/punycode |  | 
|  30 python buildtools/jshydra/abp_rewrite.py lib/publicSuffixList.js lib/url.js > ..
    /abp2blocklist/adblockplus/url.js |  | 
|  31 python buildtools/jshydra/abp_rewrite.py adblockpluscore/lib/filterNotifier.js >
     ../abp2blocklist/adblockplus |  | 
|  32 python buildtools/jshydra/abp_rewrite.py adblockpluscore/lib/filterNotifier.js >
     ../abp2blocklist/adblockplus/filterNotifier.js |  | 
|  33 python buildtools/jshydra/abp_rewrite.py adblockpluscore/lib/filterClasses.js > 
    ../abp2blocklist/adblockplus/filterClasses.js |  | 
|  34 python buildtools/jshydra/abp_rewrite.py lib/utils.js > ../abp2blocklist/node_mo
    dules/utils.js |  | 
|  35 ``` |  | 
| LEFT | RIGHT |