Do you also get lazy to click on Skip Ad on youtube? Do you get annoyed when between your music marathaon an ad appears? Are you also like me who starts youtube, and gets busy with life, relying on youtube to keep playing good music, only to get interupped by those ads with Skip option. You understand youtube needs to make money so you have disabled adblocker, but still wish there was a way to skip those ads automatically?
If you answered yes to those questions, I have something for you. My latest side project just solves this unique problem which we have. All you have to do is install the chrome extension, and it will take care of skipping the ad when the timer runs out. It behaves like a gentleman, letting the ad play for 5 seconds, so that youtube can also make money, and then skip the ad for you.
How it works?
If you are not interesed to know the inner working, you can skip and download the extension from link at bottom.
For curios souls, idea is to find the Skip Ad button on the page, and once we find it, we click on it.
let skipAdBtn = document.querySelector('button.videoAdUiSkipButton'); skipAdBtn.click();
While this is the gist, it's not that easy, because the moment ad starts, this button is available in the document, but clicking on it at that moment won't do anything. We need for the Skip option to appear, before we can click and make the ad go away. For that we need to check if our button is visible on the page or not. Just checking the presence of
offsetParent on the element will tell us if the button is visible on the dom or not
skipAdBtn.offsetParent !== null.
There are few more things going in the background to make it work, you can take a look at the code here. Give it a try by downloading the extension from below link:
Have any feedback or issues? Leave a comment below or report issue on Github.