Pornhub Blacklister

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

2022-04-01 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name Pornhub Blacklister
  3. // @version 0.6
  4. // @description Delete unwanted pornhub.com videos with a list of blacklisted keywords (see code for the list)
  5. // @author J.H
  6. // @include *pornhub.com*
  7. // @icon https://www.google.com/s2/favicons?sz=64&domain=pornhub.com
  8. // @grant none
  9. // @license MIT
  10. // @run-at document-end
  11. // @namespace https://greasyfork.org/users/448067
  12. // ==/UserScript==
  13.  
  14. // Default blacklisted keywords (can be changed in the code)
  15. // for some words add space after/before the word, to avoid false positives (e.g. "mother " will not match "motherfucker")
  16. const blackList = [
  17. // incest
  18. "stepbro", "stepsis", "step bro", "step sis", "step-bro", "step-sis",
  19. "stepdad", "step dad", "step-dad", "stepsib", "step sib", "step-sib",
  20. "stepmom", "step mom", "step-mom", "stepson", "step son", "step-son",
  21. "stepaunt", "step aunt", "step-aunt", "stepuncle", "step uncle", "step-uncle",
  22. "stepcousin", "step cousin", "step-cousin", "sister's", "father ",
  23. "mother ", "daughter", "daddy", "sister ", "brother", "stepfather",
  24. "mommy", "granny", "family", " sister", "sis ", "bro ", "step-father",
  25. "step father", "step-mother", "step mother", "stepmother", "grandma",
  26. "mom ",
  27. "soeur", "sœur", "papa", "maman", "fils", "frère", "frere", "frangine", // in french
  28. "cousine", "famille", "mère", "familiale", "dad ", "niece", // in french
  29. // no straight safe
  30. "trap ", "futa", "trans ", " trans ", "transgender", "shemale", "trann",
  31. "sissy", "femboy", "femboi", "tgirl ", "travest", "crossdresser", "pegging",
  32. "t-girl", "ladyboy", " tgirl", "transgirl", "tbabe ", "ts ", "tgirls ", " tgirls",
  33. "Prostate", "cuck", "fatboy",
  34. // for woman
  35. "fpov", "female pov", "female point of view", "female perspective",
  36. "girlsrimming",
  37. "pov femme", "femme pov", "point de vue féminin", "point de vue femme", // in french
  38. // violence/extreme/..
  39. "rape ", "pee", "piss ", "femdom",
  40. "pipi", // in french
  41. // other
  42. "babysitter", "baby sitter", "baby-sitter", "doll ", "escort ", "feet", "foot ",
  43. "ado ", "married", "mature ", "strapon", "cougar", "bbw",
  44. "poupée", "poupee", "escorte ", // in french
  45. ];
  46.  
  47. const cs = ["color: red", "color: white"];
  48. const colorPrint = function(videoTitle, ...args) {
  49. args = args.filter(arg => arg !== 0);
  50. console.log(
  51. '%c[Pornhub Blacklister]%c: ' + videoTitle + ' %c[removed]',
  52. 'color: green', 'color: white', ...args, 'color: green'
  53. );
  54. }
  55.  
  56. // select all elements with class "videoBox" "videoWrapper"
  57. const divs_pc = document.querySelectorAll(".videoBox"); // Computer divs
  58. const divs_mobile = document.querySelectorAll(".videoWrapper") // Mobile divs
  59. const divs = divs_pc.length > 0 ? divs_pc : divs_mobile;
  60. // loop through all elements from the div and find first <a> element, then print data-title attribute
  61. divs.forEach((div) => {
  62. let videoTitle = div.querySelector("a").getAttribute("data-title") !== null ? div.querySelector("a").getAttribute("data-title") : div?.querySelector("img")?.getAttribute("alt") ?? null;
  63. if (videoTitle) {
  64. blackList.forEach((blackWord) => {
  65. // if videoTitle contains blacklisted word
  66. if (videoTitle.toLowerCase().includes(blackWord)) {
  67. const start = videoTitle.toLowerCase().indexOf(blackWord);
  68. const end = start + blackWord.length;
  69. // check if the blacklisted word finish with a space, check if it's a "real" word (not a part of another word)
  70. if (blackWord[blackWord.length - 1] == " ") {
  71. const beforeAndAfter = videoTitle.toLowerCase().substring(start - 1, end + 1);
  72. if (beforeAndAfter[0] != " " && beforeAndAfter.startsWith(blackWord) == false) {
  73. return;
  74. }
  75. }
  76. // remove the video element
  77. div.remove();
  78. // add %c before/after every blacklisted word in the video title
  79. videoTitle = videoTitle.substring(0, start) + "%c" + videoTitle.substring(start, end) + "%c" + videoTitle.substring(end);
  80. }
  81. });
  82. const count = (videoTitle.match(/%c/g) || []).length / 2;
  83. if (count > 0) {
  84. colorPrint(videoTitle,
  85. 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,
  86. 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
  87. );
  88. }
  89. }
  90. });