With the recent efforts YouTube have been taking to stop adblockers it seems they have now come for the chrome extensions that skip the ads instead. As of 2024/1/17 it seems like they have completely disabled any automated methods I can come up with to press the “skip ad” button

I am by no means experienced in js but have managed to come up with a few things, so far I have tried all of:

const click = (clazz) => {
    const buttons = document.getElementsByClassName(clazz);
    for (const button of buttons) {
        console.log(button)
        button.click()
        button.dispatchEvent(
            new MouseEvent('click')
            );
    }
};
click("ytp-ad-skip-button-modern")

and the equivalent using subsequent mousedown/up and pointerdown/up events, none of which seem to work

I thought perhaps there was some hidden check that the button was being hovered over and so included:

const mouseover = (clazz) => {
    const buttons = document.getElementsByClassName(clazz);
    for (const button of buttons) {
        console.log(button)
        button.dispatchEvent(
            new MouseEvent('mouseover')
            );
    }
};
mouseover('ytp-ad-skip-button-modern')

This indeed changes the skip button’s opacity as one would expect from the mouseover event, but still no luck in actually skipping.

It feels like me vs Google at this point, anyone got any ideas?

New contributor

Pet’li is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.