How to use the @cliqz/adblocker-puppeteer.PuppeteerBlocker.fromLists function in @cliqz/adblocker-puppeteer

To help you get started, we’ve selected a few @cliqz/adblocker-puppeteer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microlinkhq / browserless / packages / goto / scripts / postinstall.js View on Github external
const main = async () => {
  // create a ad-blocker engine
  const engine = await PuppeteerBlocker.fromLists(fetch, fullLists)
  await writeFile(OUTPUT_FILENAME, engine.serialize())
}
github cliqz-oss / adblocker / packages / adblocker-puppeteer-example / index.ts View on Github external
(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);

@cliqz/adblocker-puppeteer

Ghostery adblocker Puppeteer wrapper

MPL-2.0
Latest version published 2 months ago

Package Health Score

56 / 100
Full package analysis

Similar packages