Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement PuppeteerBlocker abstraction #177

Merged
merged 15 commits into from
Jun 17, 2019

Conversation

remusao
Copy link
Collaborator

@remusao remusao commented Jun 15, 2019

Enable full adblocking in puppeteer with only few lines of code:

import { PuppeteerBlocker } from '@cliqz/adblocker';
import puppeteer from 'puppeteer';

// Create puppeteer instance
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();

// Create blocker instance
const blocker = PuppeteerBlocker.parse('||tracker.com'); // replace with desired subscriptions
await blocker.enableBlockingInPage(page);

// Navigate to page
await page.goto('https://youtube.com');

@remusao remusao changed the title High level abstractions Implement PuppeteerBlocker abstraction Jun 15, 2019
@remusao remusao merged commit 6a7ebd9 into ghostery:master Jun 17, 2019
@remusao remusao mentioned this pull request Jun 17, 2019
remusao added a commit that referenced this pull request Jun 17, 2019
* In `debug` mode, make FiltersEngine creation and updates deterministic [#176](#176)
* Fix bug in ID computation for `:style(...)` cosmetic filters [#176](#176)
* Detect invalid cases of `domain=` options in NetworkFilter [#176](#176)
* Make `generateDiff` more robust and cover corner case with ID collision [#176](#176)
* Add stress-test for FiltersEngine updates. This allows us to validate all past updates of all supported lists [#176](#176)
* Provide high level puppeteer blocker abstraction [#177](#177)
  * [BREAKING] rename `WebExtensionEngine` into `WebExtensionBlocker`
  * [BREAKING] change format of `redirect` field in blocking response, it now
    exposes more information about the redirected resource: `contentType`,
    `body` and `dataUrl` (which was the only information originally returned
    by `FiltersEngine.match(...)`).
  * Rename `example` into `examples` and move test webextension into `examples/webextension`
* Add missing dependencies on @types/puppeteer needed by users of the library [#174](#174)
@remusao remusao deleted the high-level-abstractions branch September 5, 2019 11:40
@remusao remusao added the PR: New Feature 🚀 Increment minor version when merged label Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: New Feature 🚀 Increment minor version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant