OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Finding some way to click the skip ad button that youtube has blocked

  • Thread starter Thread starter Pet'li
  • Start date Start date
P

Pet'li

Guest
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:

Code:
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:

Code:
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?

<p>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</p>
<p>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:</p>
<pre><code>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")
</code></pre>
<p>and the equivalent using subsequent <code>mousedown/up</code> and <code>pointerdown/up</code> events, none of which seem to work</p>
<p>I thought perhaps there was some hidden check that the button was being hovered over and so included:</p>
<pre><code>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')
</code></pre>
<p>This indeed changes the skip button's opacity as one would expect from the mouseover event, but still no luck in actually skipping.</p>
<p>It feels like me vs Google at this point, anyone got any ideas?</p>
 
Top