Pornhub Blacklister

Delete unwanted pornhub.com videos with a list of blacklisted keywords (see code for the list)

Pada tanggal 01 April 2022. Lihat %(latest_version_link).

// ==UserScript==
// @name         Pornhub Blacklister
// @version      0.6
// @description  Delete unwanted pornhub.com videos with a list of blacklisted keywords (see code for the list)
// @author       J.H
// @include      *pornhub.com*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=pornhub.com
// @grant        none
// @license MIT
// @run-at       document-end
// @namespace https://greasyfork.org/users/448067
// ==/UserScript==

// Default blacklisted keywords (can be changed in the code)
// for some words add space after/before the word, to avoid false positives (e.g. "mother " will not match "motherfucker")
const blackList = [
    // incest
    "stepbro", "stepsis", "step bro", "step sis", "step-bro", "step-sis",
    "stepdad", "step dad", "step-dad", "stepsib", "step sib", "step-sib",
    "stepmom", "step mom", "step-mom", "stepson", "step son", "step-son",
    "stepaunt", "step aunt", "step-aunt", "stepuncle", "step uncle", "step-uncle",
    "stepcousin", "step cousin", "step-cousin", "sister's", "father ",
    "mother ", "daughter", "daddy", "sister ", "brother", "stepfather",
    "mommy", "granny", "family", " sister", "sis ", "bro ", "step-father",
    "step father", "step-mother", "step mother", "stepmother", "grandma",
    "mom ",
    "soeur", "sœur", "papa", "maman", "fils", "frère", "frere", "frangine", // in french
    "cousine", "famille", "mère", "familiale", "dad ", "niece", // in french
    // no straight safe
    "trap ", "futa", "trans ", " trans ", "transgender", "shemale", "trann",
    "sissy", "femboy", "femboi", "tgirl ", "travest", "crossdresser", "pegging",
    "t-girl", "ladyboy", " tgirl", "transgirl", "tbabe ", "ts ", "tgirls ", " tgirls",
    "Prostate", "cuck", "fatboy",
    // for woman
    "fpov", "female pov", "female point of view", "female perspective",
    "girlsrimming",
    "pov femme", "femme pov", "point de vue féminin", "point de vue femme", // in french
    // violence/extreme/..
    "rape ", "pee", "piss ", "femdom",
    "pipi", // in french
    // other
    "babysitter", "baby sitter", "baby-sitter", "doll ", "escort ", "feet", "foot ",
    "ado ", "married", "mature ", "strapon", "cougar", "bbw",
    "poupée", "poupee", "escorte ", // in french
];

const cs = ["color: red", "color: white"];
const colorPrint = function(videoTitle, ...args) {
    args = args.filter(arg => arg !== 0);
    console.log(
        '%c[Pornhub Blacklister]%c: ' + videoTitle + ' %c[removed]',
        'color: green', 'color: white', ...args, 'color: green'
    );
}

// select all elements with class "videoBox" "videoWrapper"
const divs_pc = document.querySelectorAll(".videoBox"); // Computer divs
const divs_mobile = document.querySelectorAll(".videoWrapper") // Mobile divs
const divs = divs_pc.length > 0 ? divs_pc : divs_mobile;
// loop through all elements from the div and find first <a> element, then print data-title attribute
divs.forEach((div) => {
    let videoTitle = div.querySelector("a").getAttribute("data-title") !== null ? div.querySelector("a").getAttribute("data-title") : div?.querySelector("img")?.getAttribute("alt") ?? null;
    if (videoTitle) {
        blackList.forEach((blackWord) => {
            // if videoTitle contains blacklisted word
            if (videoTitle.toLowerCase().includes(blackWord)) {
                const start = videoTitle.toLowerCase().indexOf(blackWord);
                const end = start + blackWord.length;
                // check if the blacklisted word finish with a space, check if it's a "real" word (not a part of another word)
                if (blackWord[blackWord.length - 1] == " ") {
                    const beforeAndAfter = videoTitle.toLowerCase().substring(start - 1, end + 1);
                    if (beforeAndAfter[0] != " " && beforeAndAfter.startsWith(blackWord) == false) {
                        return;
                    }
                }
                // remove the video element
                div.remove();
                // add %c before/after every blacklisted word in the video title
                videoTitle = videoTitle.substring(0, start) + "%c" + videoTitle.substring(start, end) + "%c" + videoTitle.substring(end);
            }
        });
        const count = (videoTitle.match(/%c/g) || []).length / 2;
        if (count > 0) {
            colorPrint(videoTitle,
                count > 0 ? cs[0] : 0, count > 0 ? cs[1] : 0, count > 1 ? cs[0] : 0, count > 1 ? cs[1] : 0, count > 2 ? cs[0] : 0, count > 2 ? cs[1] : 0,
                count > 3 ? cs[0] : 0, count > 3 ? cs[1] : 0, count > 4 ? cs[0] : 0, count > 4 ? cs[1] : 0, count > 5 ? cs[0] : 0, count > 5 ? cs[1] : 0
            );
        }
    }
});