YT Adblocker

Skips video-ads

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         YT Adblocker
// @namespace    http://tampermonkey.net/
// @version      2025-12-18
// @description  Skips video-ads
// @author       Cepoglazik
// @license      MIT
// @match *://www.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  function removeAllAds() {
      const ytdRichItemRendererElements = document.querySelectorAll("ytd-rich-item-renderer");
      ytdRichItemRendererElements.forEach(ytd => {
        if (ytd.querySelector(".yt-badge-shape__text")) {
          if (ytd.querySelector(".yt-badge-shape__text").textContent === "Реклама") {
            ytd.remove();
            console.log("Was deleted:", ytd);
          }
        }
      });
  }

  const h4bjkgfbkje = setInterval(() => {
    removeAllAds();
  }, 1000);

  const njktynh = setInterval(() => {
    if (document.querySelectorAll(".ytp-ad-player-overlay-layout").length > 0) {
      const videoElement = document.querySelector("video");
      const videoDuration = Math.floor(videoElement.duration);
      videoElement.currentTime = videoDuration;
      const skipButton = document.querySelector(".ytp-skip-ad-button");
      if (videoElement.paused) {
        videoElement.play();
      }
      console.log("Skipped ad");
    }
  }, 750);

  window.addEventListener("resize", () => {
    setTimeout(() => {
      removeAllAds();
    }, 200);
  });
})();