Last active
July 7, 2025 21:51
-
-
Save EMG999/4fd4564b75f1e54697e3755171a3e05b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:const clear=(()=>{let e=e=>null!=e,r=["ytd-video-masthead-ad-v3-renderer","ytd-engagement-panel-title-header-renderer","ytd-display-ad-renderer","ytd-promoted-sparkles-web-renderer","ytd-compact-promoted-video-renderer","ytd-action-companion-ad-renderer","ytd-action-engagement-panel-content-renderer","ytd-banner-promo-renderer","ytd-in-feed-ad-layout-renderer","ytd-ad-inline-playback-meta-block","ytd-player-legacy-desktop-watch-ads-renderer","ytd-ads-engagement-panel-content-renderer"],o=setInterval(()=>{for(staticAd in r)e(document.querySelector(r[staticAd]))&&(document.querySelector(r[staticAd]).remove(),console.info("%cStatic Ad Blocked!","background: rgba(0,204,0,0.2); color: yellow;display: block"));let o=document.querySelectorAll(".ad-showing")[0],l=document.getElementsByClassName("ytp-ad-skip-button")[0];if(e(o)){let t=document.querySelector("video");e(t)&&(t.currentTime=t.duration,l.click(),console.info("%cAd Blocked!","background: rgba(0,204,0,0.2); color: yellow;display: block"))}},1);return function(){clearTimeout(o)}})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const clear = (() => { | |
| const defined = v => v !== null && v !== undefined; | |
| const staticAds = ["ytd-video-masthead-ad-v3-renderer","ytd-engagement-panel-title-header-renderer","ytd-display-ad-renderer","ytd-promoted-sparkles-web-renderer","ytd-compact-promoted-video-renderer","ytd-action-companion-ad-renderer","ytd-action-engagement-panel-content-renderer","ytd-banner-promo-renderer","ytd-in-feed-ad-layout-renderer","ytd-ad-inline-playback-meta-block","ytd-player-legacy-desktop-watch-ads-renderer","ytd-ads-engagement-panel-content-renderer"]; | |
| const timeout = setInterval(() => { | |
| for(staticAd in staticAds){ | |
| if(defined(document.querySelector(staticAds[staticAd]))){ | |
| document.querySelector(staticAds[staticAd]).remove(); | |
| console.info("%cStatic Ad Blocked!",'background: rgba(0,204,0,0.2); color: yellow;display: block'); | |
| } | |
| } | |
| const ad = document.querySelectorAll('.ad-showing')[0]; | |
| const $skip = document.getElementsByClassName("ytp-ad-skip-button")[0] | |
| if (defined(ad)) { | |
| const video = document.querySelector('video'); | |
| if (defined(video)) { | |
| video.currentTime = video.duration; | |
| $skip.click(); | |
| console.info("%cAd Blocked!",'background: rgba(0,204,0,0.2); color: yellow;display: block'); | |
| } | |
| } | |
| }, | |
| 1); | |
| return function() { | |
| clearTimeout(timeout); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi mate really impressed with this but only thing please could you add it so it auto skips the ads insead of me having me to click skip add.