You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to add one more list which I have stored in local file? I know there is const engine = FiltersEngine.parse(fs.readFileSync('easylist.txt', 'utf-8')); but how to combine both aspects together?
Sorry, I am node/js beginner. I plan to integrate this great project withing RSS Guard - feed reader used by thousands of users.
The text was updated successfully, but these errors were encountered:
Thanks for your interest. I think the easiest way to achieve this at the moment is to use the updateFromDiff method available on instances of FiltersEngine; it can add new filters (expressed as arrays of strings, and remove existing ones from the engine as well). Here is how it could look like with a self-contained example:
constadblock=require("@cliqz/adblocker");constfetch=require("node-fetch");constfs=require("fs");(async()=>{constengine=awaitadblock.FiltersEngine.fromLists(fetch,["https://easylist.to/easylist/easylist.txt","https://raw.githubusercontent.com/tomasko126/easylistczechandslovak/master/filters.txt",]);// Before updateconsole.log(engine.getFilters().networkFilters.length);engine.updateFromDiff({added: fs.readFileSync("./custom.txt","utf-8").split("\n"),});// Afer updateconsole.log(engine.getFilters().networkFilters.length);})();
And content of custom.txt would contain one rule (a.k.a. filter) per line:
I have several remote list URLs like:
'https://easylist.to/easylist/easylist.txt',
'https://raw.githubusercontent.com/tomasko126/easylistczechandslovak/master/filters.txt'
so I use this to create engine:
How to add one more list which I have stored in local file? I know there is
const engine = FiltersEngine.parse(fs.readFileSync('easylist.txt', 'utf-8'));
but how to combine both aspects together?Sorry, I am node/js beginner. I plan to integrate this great project withing RSS Guard - feed reader used by thousands of users.
The text was updated successfully, but these errors were encountered: