-
Notifications
You must be signed in to change notification settings - Fork 161
Open
Description
i am trying to make a link filter using this list but I can't seem to get the rewritten url, here is my code along with what i expect. Am i missing something to enable removeparam in the docs?
import adblockRust from 'adblock-rs';
import fs from 'node:fs';
const dataPath = './data/adblock-rust-master/data/'
const debugInfo = true;
const filterSet = new adblockRust.FilterSet(debugInfo);
const shortenerFilters = fs.readFileSync(
'LegitimateURLShortener.txt',
{ encoding: 'utf-8' },
).split('\n');
filterSet.addFilters(shortenerFilters);
console.log(shortenerFilters[0])
// const easylistFilters = fs.readFileSync(
// dataPath + 'easylist.to/easylist/easylist.txt',
// { encoding: 'utf-8' },
// ).split('\n');
// filterSet.addFilters(easylistFilters);
const uboUnbreakFilters = fs.readFileSync(
dataPath + 'uBlockOrigin/unbreak.txt',
{ encoding: 'utf-8' },
).split('\n');
filterSet.addFilters(uboUnbreakFilters);
const resources = adblockRust.uBlockResources(
dataPath + 'test/fake-uBO-files/web_accessible_resources',
dataPath + 'test/fake-uBO-files/redirect-resources.js',
dataPath + 'test/fake-uBO-files/scriptlets.js'
);
const engine = new adblockRust.Engine(filterSet, true);
engine.useResources(resources);
console.log(engine.check(
'https://www.amazon.com/National-Geographic-Hobby-Rock-Tumbler/dp/B01LQCIL88/?_encoding=UTF8&pd_rd_w=a88WT&content-id=amzn1.sym.12c47663-8a7e-43d5-9c0a-9fb1870a90c3&pf_rd_p=12c47663-8a7e-43d5-9c0a-9fb1870a90c3&pf_rd_r=3BKDDFN4AJ4N5805MMKF&pd_rd_wg=JVspV&pd_rd_r=da0cab95-d366-49ed-a9a9-52f9a277bf62&ref_=pd_hp_d_atf_dealz_cs',
'https://amazon.com',
'html',
true
));
result:
! Title: ➗ Actually Legitimate URL Shortener Tool
{
matched: false,
important: false,
redirect: null,
rewritten_url: null,
exception: null,
filter: null
}
expected:
! Title: ➗ Actually Legitimate URL Shortener Tool
{
matched: True,
important: false,
redirect: null,
rewritten_url: 'https://www.amazon.com/National-Geographic-Hobby-Rock-Tumbler/dp/B01LQCIL88/?_encoding=UTF8',
exception: null,
filter: null
}
thank you!
Metadata
Metadata
Assignees
Labels
No labels