Greasy Fork

Greasy Fork is available in English.

Youtube AdBlock Ban Bypass

Fix the "Ad blockers violate YouTube's Terms of Service" Error

当前为 2023-10-18 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    // ==UserScript==
    // @name         Youtube AdBlock Ban Bypass
    // @namespace    http://tampermonkey.net/
    // @version      0.43
    // @description  Fix the "Ad blockers violate YouTube's Terms of Service" Error
    // @author       Obelous
    // @match        https://www.youtube.com/*
    // @match        https://www.youtube-nocookie.com/*
    // @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
    // @grant        none
    // @license      MIT
    // ==/UserScript==

    let currentPageUrl = window.location.href;

    window.addEventListener('beforeunload', function () {
        currentPageUrl = window.location.href;
    });

    /*document.addEventListener('yt-navigate-finish', function () {
        const newUrl = window.location.href;
        if (newUrl !== currentPageUrl) {
            location.reload();
        }
    });*/

    function splitUrl(str) {
        return str.split('=')[1];
    }

    function run() {
        console.log("Loaded");
        const block = document.querySelector('.yt-playability-error-supported-renderers');
        block.parentNode.removeChild(block);
        const oldplayer = document.getElementById("error-screen");
        const alert = document.createElement('h1');
        alert.textContent = "Click to play";
        alert.style = "color: white; font-size: 80px; padding:20px";
        const player = document.createElement('div');
        player.style = "height:100%;width:100%;border-radius:12px; cursor: pointer; background-color: #242424;";
        player.addEventListener ("click", redirect , false);
        player.id = "youtube-iframe";
        player.appendChild(alert);
        oldplayer.appendChild(player);
        console.log('Finished');
    }

    function redirect() {
        const url = "https://youtube.com/embed/" + splitUrl(window.location.href);
        window.open(url, '_blank')
    }

    (function() {
        'use strict';
        //|             |||
        // RUN DELAY    VVV
        setTimeout(run, 1000);
    })();