Privacy Frontend Redirect

This script redirects to privacy friendly front-ends of popular services, such as YouTube, Twitter, Reddit, Imgur, Instagram, TikTok, etc. Additionally, it replaces iframes and outgoing links to non frontend services with their privacy-friendly counterparts. The purpose of this script is to protect the user's privacy by avoiding the collection of personal data by these services.

  1. // ==UserScript==
  2. // @name Privacy Frontend Redirect
  3. // @match *://*/*
  4. // @exclude *://account*/*
  5. // @exclude *://message*/*
  6. // @exclude *://adsense.google.com/*
  7. // @exclude *://www.google.com/adsense/*
  8. // @exclude *://www.google.com/maps/*
  9. // @grant none
  10. // @version 4.2.10
  11. // @author NoUser
  12. // @description This script redirects to privacy friendly front-ends of popular services, such as YouTube, Twitter, Reddit, Imgur, Instagram, TikTok, etc. Additionally, it replaces iframes and outgoing links to non frontend services with their privacy-friendly counterparts. The purpose of this script is to protect the user's privacy by avoiding the collection of personal data by these services.
  13. // @run-at document-start
  14. // @namespace https://greasyfork.org/en/scripts/458875-privacy-frontend-redirect
  15. // @homepage https://greasyfork.org/en/scripts/458875-privacy-frontend-redirect
  16. // @license MIT
  17. // ==/UserScript==
  18.  
  19. const hostname = window.location.hostname;
  20. const hosts = {
  21. "www.youtube.com": ["invidious.privacydev.net", "vid.puffyan.us", "inv.vern.cc", "invidious.kavin.rocks", "invidious.tiekoetter.com", "inv.riverside.rocks", "iv.ggtyler.dev", "invidious.nerdvpn.de"],
  22. "www.youtube-nocookie.com": ["invidious.privacydev.net", "vid.puffyan.us", "inv.vern.cc", "invidious.kavin.rocks", "invidious.tiekoetter.com", "inv.riverside.rocks", "iv.ggtyler.dev", "invidious.nerdvpn.de"],
  23. "m.youtube.com": ["invidious.privacydev.net", "vid.puffyan.us", "inv.vern.cc", "invidious.kavin.rocks", "invidious.tiekoetter.com", "inv.riverside.rocks", "iv.ggtyler.dev", "invidious.nerdvpn.de"],
  24. "music.youtube.com": ["hyperpipe.surge.sh", "hyperpipe.esmailelbob.xyz", "music.adminforge.de"],
  25. "twitter.com": ["nitter.sneed.network", "canada.unofficialbird.com", "nitter.privacytools.io", "nitter.foss.wtf", "nitter.privacy.com.de", "nitter.1d4.us", "nitter.poast.org", "twitter.censors.us"],
  26. "mobile.twitter.com": ["nitter.sneed.network", "canada.unofficialbird.com", "nitter.privacytools.io", "nitter.foss.wtf", "nitter.privacy.com.de", "nitter.1d4.us", "nitter.poast.org", "twitter.censors.us"],
  27. "www.reddit.com": ["libreddit.eu.org", "libreddit.spike.codes", "lr.odyssey346.dev", "rd.funami.tech", "libreddit.dcs0.hu", "lr.vern.cc"],
  28. "old.reddit.com": ["libreddit.eu.org", "libreddit.spike.codes", "lr.odyssey346.dev", "rd.funami.tech", "libreddit.dcs0.hu", "lr.vern.cc"],
  29. "imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  30. "i.imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  31. "i.stack.imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  32. "www.instagram.com": ["bibliogram.froth.zone", "ig.tokhmi.xyz"],
  33. "www.tiktok.com": ["proxitok.pussthecat.org", "tok.habedieeh.re", "tok.artemislena.eu", "proxitok.privacydev.net"],
  34. "www.imdb.com": ["ld.vern.cc", "libremdb.esmailelbob.xyz", "lmdb.tokhmi.xyz", "libremdb.iket.me", "libremdb.pussthecat.org"],
  35. "translate.google.com": ["simplytranslate.esmailelbob.xyz", "simplytranslate.manerakai.com", "translate.bus-hit.me", "translate.northboot.xyz", "translate.tiekoetter.com", "tl.vern.cc", "translate.slipfox.xyz"],
  36. "medium.com": ["scribe.rip", "scribe.nixnet.services", "scribe.citizen4.eu", "scribe.bus-hit.me", "scribe.froth.zone", "scribe.rawbit.ninja"],
  37. "www.urbandictionary.com": ["rd.vern.cc", "ruraldictionary.esmailelbob.xyz"],
  38. "stackoverflow.com": ["code.whatever.social", "ao.vern.cc", "overflow.smnz.de", "anonymousoverflow.esmailelbob.xyz", "overflow.adminforge.de", "ao.foss.wtf", "overflow.hostux.net"],
  39. "www.goodreads.com": ["biblioreads.ml", "bl.vern.cc", "biblioreads.esmailelbob.xyz"],
  40. "www.snopes.com": ["sd.vern.cc", "suds.esmailelbob.xyz"],
  41. "www.xvideos.com": ["porninvidious.esmailelbob.xyz"],
  42. // "www.google.com": ["whoogle.hostux.net", "wg.vern.cc", "whoogle.privacydev.net", "whoogle.dcs0.hu", "search.sethforprivacy.com"],
  43. "en.wikipedia.org": ["wiki.froth.zone", "wikiless.esmailelbob.xyz", "wikiless.northboot.xyz", "wl.vern.cc"],
  44. "de.wikipedia.org": ["wiki.adminforge.de"],
  45. "www.instructables.com": ["destructables.esmailelbob.xyz"],
  46. "www.reuters.com": ["neuters.de", "neuters.esmailelbob.xyz"],
  47. "scratch.mit.edu": ["scratchgui.esmailelbob.xyz", "scratch.machinelearningforkids.co.uk"],
  48. "odysee.com": ["lbry.projectsegfau.lt", "librarian.esmailelbob.xyz"],
  49. "yiffer.xyz": ["yiffest.programmerpony.com"],
  50. "www.wolframalpha.com": ["wolfree.chickenkiller.com", "wolfree.crabdance.com", "wolfree.gitlab.io", "wolfree.ignorelist.com", "wolfree.jumpingcrab.com", "wolfree.my.to", "wolfree.netlify.app", "wolfree.onrender.com", "wolfree.pages.dev", "wolfree.privatedns.org", "wolfree.strangled.net"],
  51. "quizlet.com": ["requiz.net"],
  52. // "amazon.com": ["simpleamazon.esmailelbob.xyz", "amazon.simple-web.org"],
  53. // "github.com": ["gh.odyssey346.dev", "gh.riverside.rocks", "gh.vern.cc", "gh.akisblack.dev", "gh.phreedom.club"],
  54. // "akkoma.social": ["bdx.town"],
  55. // "tankerkoenig.de": ["petrolpricesv2.netlify.app"],
  56. //
  57. // Valid alternatives where end user loses nothing, not frontends
  58. //
  59. // "www.speedtest.net": ["openspeedtest.com"]
  60. // "music.apple.com": ["cider.sh"],
  61. // "www.noisli.com": ["noizee.esmailelbob.xyz"],
  62. };
  63.  
  64. const replaceUrl = (url) => {
  65. const { host, pathname } = new URL(url);
  66. if (host === 'genius.com' && pathname.endsWith('-lyrics')) {
  67. const randomHost = ['dm.vern.cc', 'sing.whatever.social'][Math.floor(Math.random() * 0.5)];
  68. return url.replace(host, randomHost);
  69. } else if (host in hosts) {
  70. let replacement = hosts[host];
  71. if (Array.isArray(replacement)) {
  72. replacement = replacement[Math.floor(Math.random() * replacement.length)];
  73. }
  74. return url.replace(host, replacement);
  75. }
  76. return url;
  77. };
  78.  
  79. try {
  80. const replacement = hosts[hostname];
  81. if (replacement) {
  82. const newUrl = replaceUrl(window.location.href);
  83. if (newUrl !== window.location.href) {
  84. window.location.replace(newUrl);
  85. }
  86. } else if (hostname === "genius.com" && window.location.pathname.endsWith("-lyrics")) {
  87. const randomHost = ["dm.vern.cc", "sing.whatever.social"][Math.floor(Math.random() * 0.5)];
  88. window.location.hostname = randomHost;
  89. } else if (hostname.endsWith('.bandcamp.com')) {
  90. const subdomain = hostname.slice(0, -'.bandcamp.com'.length);
  91. const path = window.location.pathname.split('/');
  92. if (path[1] === 'search') {
  93. const newUrl = `https://tent.bloatcat.tk/search.php?query=${path[2]}`;
  94. if (newUrl !== window.location.href) {
  95. window.location.replace(newUrl);
  96. }
  97. } else if (path[1] === 'img') {
  98. const newUrl = `https://tent.bloatcat.tk/image.php?file=${path[2]}`;
  99. if (newUrl !== window.location.href) {
  100. window.location.replace(newUrl);
  101. }
  102. } else if (path[1] === 'stream') {
  103. const [_, directory, format, file, token] = path;
  104. const newUrl = `https://tent.bloatcat.tk/audio.php?directory=${directory}&format=${format}&file=${file}&token=${token}`;
  105. if (newUrl !== window.location.href) {
  106. window.location.replace(newUrl);
  107. }
  108. } else {
  109. const newUrl = `https://tent.bloatcat.tk/release.php?artist=${subdomain}&type=${path[1]}&name=${path[2]}`;
  110. if (newUrl !== window.location.href) {
  111. window.location.replace(newUrl);
  112. }
  113. }
  114. }
  115. } catch (error) {
  116. console.error(error.message);
  117. }
  118.  
  119. window.addEventListener("load", function () {
  120. try {
  121. const iframes = document.querySelectorAll(`iframe[src*="${window.location.host}"]`);
  122. iframes.forEach(iframe => {
  123. const newIframe = document.createElement('iframe');
  124. const attributes = ['src', 'width', 'height', 'frameborder', 'allowfullscreen', 'allow', 'title'];
  125. attributes.forEach(attribute => {
  126. if (iframe.hasAttribute(attribute)) {
  127. newIframe.setAttribute(attribute, iframe.getAttribute(attribute));
  128. }
  129. });
  130. iframe.parentNode.replaceChild(newIframe, iframe);
  131. });
  132. const links = document.querySelectorAll("a");
  133. links.forEach(link => {
  134. const href = link.href;
  135. const newUrl = replaceUrl(href);
  136. if (newUrl !== href) {
  137. link.href = newUrl;
  138. }
  139. });
  140. } catch (error) {
  141. console.error(error.message);
  142. }
  143. });