ghostery / adblocker

Efficient embeddable adblocker library

Home Page:https://www.ghostery.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't block in-stream youtube ads

danline opened this issue · comments

I am using the default list that comes with the library and it doesn't seem to block in-stream ads on youtube (although it seems to block in-feed and bumper-ads).

I am using the adsAndTrackingLists list as below:

import { ElectronBlocker, adsAndTrackingLists } from '@cliqz/adblocker-electron';

Should I be using a different list or is blocking in-stream ads not supported?

commented

Hi @danline,

I think this should be working. Can you tell more about how you integrate the adblocker into your project? In particular we need to make sure cosmetics (relying on a preload script) are working as expected.

Hi @remusao, that is probably the issue because I had to disable loadCosmeticFilters config due to a prod preload issue I was experiencing in my project when using ad blocker.

import { ElectronBlocker, adsAndTrackingLists } from '@cliqz/adblocker-electron';
import fetch from 'cross-fetch'; // required 'fetch'

const adBlocker = await ElectronBlocker.fromLists(
    fetch,
    adsAndTrackingLists,
    {
        loadCosmeticFilters: false
    }
);

adBlocker.enableBlockingInSession(session)

I am glad blocking in-video ads are supported by this library. I will try to make the preload script for loading cosmetic filters work in my project. Hopefully that takes care of it.

Thanks!!

commented

If that's useful, here is an example of project that has some custom handling of bundling the preload script: https://github.com/wexond/browser-base/blob/a0d424b409d68878369b587f4cc3d5f38fe77784/webpack.config.js#L25

This is perfect, thank you!!