Ad skipper yt

Play Youtube ads at 5x speed, and skip after 6 seconds undetected.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Ad skipper yt
// @license      MIT
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Play Youtube ads at 5x speed, and skip after 6 seconds undetected.
// @author       TTT
// @match        https://www.youtube.com/*
// @grant        none
// ==/UserScript==
const targetNode = document.body;
const config = { attributes: false, childList: true, subtree: true };
const callback = function(mutationsList, observer) {
  for (const mutation of mutationsList) {
    if (mutation.type === 'childList') {
      document.querySelectorAll('.ytp-ad-text').forEach(adText => {
        var player = document.querySelector('.video-stream.html5-main-video');
        if (player) {
          player.playbackRate = 5;
          if (player.currentTime > 29) {
            if (document.contains(document.getElementsByClassName("ytp-preview-ad")[0])) {
              document.getElementsByClassName("html5-video-container")[0].children[0].currentTime = 250;
            }
            if (document.contains(document.getElementsByClassName('ytp-skip-ad-button__text')[0])) {
              document.getElementsByClassName('ytp-skip-ad-button__text')[0].click();
            }
          }
        }
      });
    }
  }
};
const observer = new MutationObserver(callback);
observer.observe(targetNode, config);