Pornhub Blacklister

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

As of 24.03.2022. See ბოლო ვერსია.

// ==UserScript==
// @name         Pornhub Blacklister
// @version      0.4
// @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")
let 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",
    "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
];

function colorPrint(videoTitle, ...args) {
    console.log(
        '%c[Pornhub Blacklister]%c: ' + videoTitle + ' %c[removed]',
        'color: green',
        'color: white',
        'color: red',
        'color: white',
        ...args,
        'color: green',
    );
  }

// select all elements with class "videoBox"
let div = document.querySelectorAll(".videoBox");
// loop through all elements from the div and find first <a> element, then print data-title attribute
for (var i = 0; i < div.length; i++) {
    let videoTitle = div[i].querySelector("a").getAttribute("data-title");
    if (videoTitle != null) {
        for (var j = 0; j < blackList.length; j++) {
            // if videoTitle contains blacklisted word
            if (videoTitle.toLowerCase().includes(blackList[j])) {
                // add %c before and after blacklisted word find in videoTitle string
                let start = videoTitle.toLowerCase().indexOf(blackList[j]);
                let end = start + blackList[j].length;
                // check if the blacklisted word finish with a space, check if it's a "real" word (not a part of another word)
                if (blackList[j].charAt(blackList[j].length - 1) == " ") {
                    let beforeAndAfter = videoTitle.toLowerCase().substring(start - 1, end + 1);
                    if (beforeAndAfter.charAt(0) != " " && beforeAndAfter.startsWith(blackList[j]) == false) {
                        continue;
                    }
                }
                // remove the video element
                div[i].remove();
                // oof, this is ugly, but it works
                videoTitle = videoTitle.substring(0, start) + "%c" + videoTitle.substring(start, end) + "%c" + videoTitle.substring(end);
                let cr = "color: red";
                let cw = "color: white";
                let count = (videoTitle.match(/%c/g) || []).length/2;
                if (count == 1) {
                    colorPrint(videoTitle);
                } else if (count == 2) {
                    colorPrint(videoTitle, cr, cw);
                } else if (count == 3) {
                    colorPrint(videoTitle, cr, cw, cr, cw);
                } else if (count == 4) {
                    colorPrint(videoTitle, cr, cw, cr, cw, cr, cw);
                } else if (count == 5) {
                    colorPrint(videoTitle, cr, cw, cr, cw, cr, cw, cr, cw);
                } else if (count == 6) {
                    colorPrint(videoTitle, cr, cw, cr, cw, cr, cw, cr, cw, cr, cw);
                }
            }
        }
    }
}