YouTube Ad Auto Report

This Script is going to check for ad on YouTube every 200ms and if it find's one it will automatically report it which results in successfully skipping it. (NOT WORKING WITH AD PERSONALISATION TURNED OFF!!!)

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         YouTube Ad Auto Report
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  This Script is going to check for ad on YouTube every 200ms and if it find's one it will automatically report it which results in successfully skipping it. (NOT WORKING WITH AD PERSONALISATION TURNED OFF!!!)
// @author       You
// @include      http://www.youtube.com/watch*
// @include      https://www.youtube.com/watch*
// @include      youtube.com/watch*
// @include      http://www.youtube.com/*
// @include      https://www.youtube.com*
// @include      youtube.com/*
// @icon         https://www.google.com/s2/favicons?domain=youtube.com
// @grant        none
// ==/UserScript==

function sleep(ms) {
    return new Promise((resolve) => {
        setTimeout(resolve, ms);
    });
}

function skipAds() {
    if (document.getElementsByClassName("ytp-ad-overlay-close-button").length != 0){
        document.getElementsByClassName("ytp-ad-overlay-close-button")[0].click();
    }
    if (document.getElementsByClassName("ytp-ad-button ytp-ad-button-link ytp-ad-clickable").length != 0) {
        document.getElementsByClassName("ytp-ad-button ytp-ad-button-link ytp-ad-clickable")[0].click();
        sleep(50);
        document.getElementsByClassName("ytp-ad-button ytp-ad-info-dialog-mute-button ytp-ad-button-link")[0].click();
        sleep(50);
        document.getElementsByClassName("ytp-ad-feedback-dialog-reason-input")[0].click();
        sleep(50);
        document.getElementsByClassName("ytp-ad-feedback-dialog-confirm-button")[0].click();
        console.log("SkippedAd");
    }
}


var start = function() {
    setInterval(function () {
        skipAds();
    }, 200);
}
document.onload = start();