Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const main = async () => {
// create a ad-blocker engine
const engine = await PuppeteerBlocker.fromLists(fetch, fullLists)
await writeFile(OUTPUT_FILENAME, engine.serialize())
}
(async () => {
const blocker = await PuppeteerBlocker.fromLists(fetch, fullLists, {
enableCompression: true,
});
const browser = await puppeteer.launch({
defaultViewport: null,
headless: false,
});
const page = await browser.newPage();
await blocker.enableBlockingInPage(page);
blocker.on('request-blocked', (request: Request) => {
console.log('blocked', request.url);
});
blocker.on('request-redirected', (request: Request) => {
console.log('redirected', request.url);