anhnt9919 / Block youtube sesitive content

// ==UserScript==
// @name         Block youtube sesitive content
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://www.youtube.com/*
// @license MIT
// @grant        none
// @require http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==

(function() {
    $(document).ready(function(){
        function checkPageContentReload(){
            ban_keywords = ["sex", "jav", "hentai", "xxx", "porn", "pussy", "ass", "butt", "tits", "boobs", "ntr", "ecchi", "kidmo", "vlxx"]
            allow_keywords = ["java", "javascript", "python"]
            if (window.location.href.match(new RegExp(allow_keywords.join("|"))) != null){
                // Continue
            }
            else if (window.location.href.match(new RegExp(ban_keywords.join("|"))) != null){
                window.location.replace("http://stackoverflow.com");
            }
        }

        function checkUrlReload(){
            keywords = ["sex", "jav", "hentai", "xxx", "porn", "pussy", "ass", "butt", "tits", "boobs", "ntr", "ecchi", "kidmo", "18+" , "19+"]
            regex = new RegExp(keywords.join("|"))
            if (window.location.href.match(regex) != null){
                window.location.replace("http://stackoverflow.com");
            }
        }

        checkUrlReload()
        checkPageContentReload()
        $('#search-icon-legacy').click(function(){
            console.log("in")
            checkPageContentReload()
            checkUrlReload()
        })
    })
})();