I could not find a clean solution for this. But below is what I did,
Option 1:
add the below code in a bookmark,
javascript:(function(){setInterval(function() { var $cross = document.getElementsByClassName("ytp-ad-overlay-close-container")[0]; var $skip = document.getElementsByClassName("ytp-ad-skip-button")[0]; if ($cross != undefined) $cross.click(); if ($skip != undefined) $skip.click() }, 2000)})();
Adding a JS code in bookmark is easy,
- just click on the bookmark icon
- click on more button
add above code in the URL and give it a name, it will now appear in the bookmark tab.
Whenever you open any youtube video just click on the bookmark you created to skip
Option 2(better option):
- Install chrome extension Requestly
- Click on
New Rule
- Select
Insert Scripts
- Give youtube in request url contains.
- Click on
Add Custom Script
and select Custom Code
- Insert Below code and click on save
setInterval(function() {
var $cross = document.getElementsByClassName("ytp-ad-overlay-close-container")[0];
var $skip = document.getElementsByClassName("ytp-ad-skip-button")[0];
if ($cross != undefined) $cross.click();
if ($skip != undefined) $skip.click()
}, 2000);
Requestly will run this code whenever youtube opens, and it will skip the ads and ad videos.
Note: this is a dirty solution and I use it and it works for me. There might be better solutions present.