youtube_search_filter4

Hide videos including specified words in the Youtube search results.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        youtube_search_filter4
// @namespace   https://catherine.v0cyc1pp.com/
// @include     https://www.youtube.com/*
// @author      greg10
// @run-at      document-start
// @license     GPL 3.0
// @version     4.0
// @grant       none
// @description Hide videos including specified words in the Youtube search results.
// ==/UserScript==


//================================
// Configurations
//   - specify texts you don't want to see.
var g_list = [
    "AKB",
    "AKB",
    "HikakinTV",
    "HikakinGames",
    "はじめしゃちょー",
    "NiziU",
    ];
//================================




function main() {

    //$("div.yt-lockup-content").each(function() {
    document.querySelectorAll("ytd-video-renderer,ytd-channel-renderer,ytd-grid-video-renderer,ytd-playlist-renderer").forEach(function(elem) {
        //var str = $(this).text();
        var str = elem.innerText;
        //console.log("str="+str);

        for (var i = 0; i < g_list.length; ++i) {
            var ngword = g_list[i];
            if (ngword == "") continue;

            ngword = ngword.replace(/^\s+|\s+$/g, "");

            var obj = new RegExp(ngword, "i");
            var index = str.search(obj);
            //var index = str.indexOf( ngword );
            if (index != -1) {
                //$(this).parent("div").parent("div").parent("li").hide();
                elem.style.display = "none";
                //console.log("str="+str);
            }
        }
    });
}

var observer = new MutationObserver(function(mutations) {
    observer.disconnect();
    main();
    observer.observe(document, config);
});

//var config = { attributes: true, childList: true, characterData: true, subtree:true }
var config = {
    childList: true,
    characterData: true,
    subtree: true
}

observer.observe(document, config);