NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Youtube Black List // @namespace http://maxagg.com // @description Removes Youtube Videos where channel and name video add to black list. // @include http://www.youtube.com/* // @include https://www.youtube.com/* // @include http://youtube.com/* // @include https://youtube.com/* // @include http://apis.google.com/*/widget/render/comments?* // @include https://apis.google.com/*/widget/render/comments?* // @include http://plus.googleapis.com/*/widget/render/comments?* // @include https://plus.googleapis.com/*/widget/render/comments?* // @version 1 // @grant none // @license MIT // ==/UserScript== // check if youtube video page is opened var loopTime = 3000; // check for annotations interval in milliseconds var loopCount = 0; var blackList = ['Майнкрафт','МАЙНКРАФТ','майнкрафт','Minecraft','minecraft','MINECRAFT','Нубик','нубик','НУБИК']; if (document.location.href.indexOf('watch?v=') > 0) { // hide videos var hideVideos = function () { var arr = document.querySelectorAll('#primary-inner'); for (var i = 0; i < arr.length; i++) { var isOk = true; var container = arr[i]; var caption = ""; var chName = ""; var captions = container.querySelectorAll('yt-formatted-string.ytd-video-primary-info-renderer'); if (captions.length>0){ for (var j=0;j< captions.length; j++){ caption += captions[j].innerHTML; } } var chNames = container.querySelectorAll('yt-formatted-string.ytd-channel-name > a'); if (chNames.length>0){ chName = chNames[0].innerHTML; } for (var j=0;j< blackList.length; j++){ if (caption.indexOf(blackList[j])>=0) isOk=false; if (chName.indexOf(blackList[j])>=0) isOk=false; } if (!isOk){container.style.visibility = 'hidden'} else { container.style.visibility = 'visible'} } } // contionous loop that hides videos var hideVideosLoop = function () { hideVideos(); setTimeout(hideVideosLoop, loopTime); } //init continuous loop hideVideosLoop(); } if (document.location.href.indexOf('youtube') > 0) { // hide videos var hideVideos2 = function () { var arr = document.querySelectorAll('ytd-compact-video-renderer'); for (var i = 0; i < arr.length; i++) { var isOk = true; var container = arr[i]; var captions = container.querySelectorAll('#video-title'); var caption = captions[0].innerHTML; var chNames = container.querySelectorAll('yt-formatted-string.ytd-channel-name'); var chName = chNames[0].innerHTML; for (var j=0;j< blackList.length; j++){ if (caption.indexOf(blackList[j])>=0) isOk=false; if (chName.indexOf(blackList[j])>=0) isOk=false; } if (!isOk) container.style.visibility = 'hidden'; } } // contionous loop that hides videos var hideVideosLoop2 = function () { hideVideos2(); setTimeout(hideVideosLoop2, loopTime); } //init continuous loop hideVideosLoop2(); } if (document.location.href.indexOf('youtube') > 0) { // hide videos var hideVideos3 = function () { var arr = document.querySelectorAll('ytd-rich-item-renderer'); for (var i = 0; i < arr.length; i++) { var isOk = true; var container = arr[i]; var captions = container.querySelectorAll('#video-title'); var caption = captions[0].innerHTML; var chNames = container.querySelectorAll('yt-formatted-string.ytd-channel-name'); var chName = chNames[0].innerHTML; for (var j=0;j< blackList.length; j++){ if (caption.indexOf(blackList[j])>=0) isOk=false; if (chName.indexOf(blackList[j])>=0) isOk=false; } if (!isOk) container.style.visibility = 'hidden'; } } // contionous loop that hides videos var hideVideosLoop3 = function () { hideVideos3(); setTimeout(hideVideosLoop3, loopTime); } //init continuous loop hideVideosLoop3(); } if (document.location.href.indexOf('youtube') > 0) { // hide videos var hideVideos4 = function () { var arr = document.querySelectorAll('ytd-video-renderer'); for (var i = 0; i < arr.length; i++) { var isOk = true; var container = arr[i]; var captions = container.querySelectorAll('#video-title'); var caption = captions[0].innerHTML; var chNames = container.querySelectorAll('yt-formatted-string.ytd-channel-name'); var chName = chNames[0].innerHTML; for (var j=0;j< blackList.length; j++){ if (caption.indexOf(blackList[j])>=0) isOk=false; if (chName.indexOf(blackList[j])>=0) isOk=false; } if (!isOk) container.style.visibility = 'hidden'; } } // contionous loop that hides videos var hideVideosLoop4 = function () { hideVideos4(); setTimeout(hideVideosLoop4, loopTime); } //init continuous loop hideVideosLoop4(); }