 
        Greasy Fork is available in English.
Bypass all youtube ads including in video ads, skipable and non-skipable Ads
当前为 
// ==UserScript==
// @name         Youtube Ad Cleaner(Include Non-Skipable Ads)
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Bypass all youtube ads including in video ads, skipable and non-skipable Ads
// @author       BjD
// @match        https://www.youtube.com/*
// ==/UserScript==
// The script runs in the backgound, monitoring all youtube ads.
// When non-skipable ads are found, the script will redirect the browser to previous page and then revisits the current URL.
// Depends on the amount of non-skipable ads, the browser may refresh couple times automatically.
var VTime;
var VideoURL;
var timer1;
var timer2;
var timer3;
var ytplayer;
setInterval(killAd, 4000);
function checker(){
    setInterval(mainTimer, 2000);
}
checker();
function mainTimer(){
    if(window.location.href == "https://www.youtube.com/") {
        stopMonitor();
    }
    else{
        startMonitor();
    }
}
function startMonitor(){
    console.log('Monitoring Youtube Ads');
    timer1 = setInterval(KillNoSkipAd, 2000);
    timer2 = setInterval(killInVideoAd, 6000);
    timer3 = setInterval(videoTimeMarker, 1000);
}
function stopMonitor(){
    clearInterval(timer1);
    clearInterval(timer2);
    clearInterval(timer3);
}
function killAd(){
    if ($(".videoAdUiRedesign")[0] !=undefined){
        $(".video-stream").attr("src", "");
    }
    $("#player-ads").remove();
    $("#masthead-ad").remove();
    $("#offer-module").remove();
    $(".video-ads").remove();
    $("#pyv-watch-related-dest-url").remove();
}
function KillNoSkipAd(){
//    if(window.location.href == "https://www.youtube.com/"){
//        VideoURL = window.location.href;
//    }
//   else{
//        VideoURL = window.location.href + '&t=' + VTime;
//    }
    if(VTime === 0 || VTime === undefined){
       VideoURL = window.location.href;}
      else{
          VideoURL = window.location.href + '&t=' + VTime;
      }
    if ($('.ad-showing') [0] !==undefined){
        console.log('No Skip Ad caught');
        window.history.back();
        window.location.href = VideoURL +'&t=' + VTime;
    }
}
function killInVideoAd(){
    if ($(".video-ads")[0] !==undefined){
        console.log('In Video Ads caught');
        $(".video-ads").remove();
    }
}
function videoTimeMarker() {
    ytplayer = document.getElementById("movie_player");
    VTime = Math.round(ytplayer.getCurrentTime());
    console.log(VTime);
    console.log(VideoURL);
}