Advertisement
jncosideout

Privacy Redirect cusomizations: GreasyFork script

Dec 27th, 2024
2,717
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. // @downloadURL https://update.greasyfork.org/scripts/458875/Privacy%20Frontend%20Redirect.user.js
  18. // @updateURL https://update.greasyfork.org/scripts/458875/Privacy%20Frontend%20Redirect.meta.js
  19. // ==/UserScript==
  20.  
  21. const hostname = window.location.hostname;
  22. const youtubeHosts = ["invidious.nerdvpn.de", "yewtu.be", "inv.nadeko.net", "invidious.jing.rocks"];
  23. const youtubeDeadHosts = ["invidious.privacydev.net", "vid.puffyan.us", "inv.vern.cc", "invidious.tiekoetter.com", "iv.ggtyler.dev", "invidious.kavin.rocks", "inv.riverside.rocks"];
  24. const hosts = {
  25.   "youtu.be": youtubeHosts,
  26.   "www.youtube.com": youtubeHosts,
  27.   "www.youtube-nocookie.com": youtubeHosts,
  28.   "m.youtube.com": youtubeHosts,
  29.   "music.youtube.com": ["hyperpipe.surge.sh", "hyperpipe.esmailelbob.xyz", "music.adminforge.de"],
  30.   "twitter.com": ["nitter.sneed.network", "canada.unofficialbird.com", "nitter.privacytools.io", "nitter.privacy.com.de", "nitter.1d4.us", "nitter.poast.org", "twitter.censors.us"],
  31.     // "nitter.foss.wtf",
  32.   "mobile.twitter.com": ["nitter.sneed.network", "canada.unofficialbird.com", "nitter.privacytools.io", "nitter.privacy.com.de", "nitter.1d4.us", "nitter.poast.org", "twitter.censors.us"],
  33.     // "nitter.foss.wtf",
  34.   "www.reddit.com": ["libreddit.northboot.xyz", "libreddit.kavin.rocks", "libreddit.eu.org", "libreddit.spike.codes", "lr.odyssey346.dev", "rd.funami.tech", "libreddit.dcs0.hu", "lr.vern.cc", "libreddit.northboot.xyz"],
  35.   "old.reddit.com": ["libreddit.eu.org", "libreddit.spike.codes", "lr.odyssey346.dev", "rd.funami.tech", "libreddit.dcs0.hu", "lr.vern.cc"],
  36.   "imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  37.   "i.imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  38.   "i.stack.imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  39.   "www.instagram.com": ["bibliogram.froth.zone", "ig.tokhmi.xyz"],
  40.   "www.tiktok.com": ["proxitok.pussthecat.org", "tok.habedieeh.re", "tok.artemislena.eu", "proxitok.privacydev.net"],
  41.   "www.imdb.com": ["ld.vern.cc", "libremdb.esmailelbob.xyz", "lmdb.tokhmi.xyz", "libremdb.iket.me", "libremdb.pussthecat.org"],
  42.   "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"],
  43.   "medium.com": ["scribe.rip", "scribe.nixnet.services", "scribe.citizen4.eu", "scribe.bus-hit.me", "scribe.froth.zone", "scribe.rawbit.ninja"],
  44.   "www.urbandictionary.com": ["rd.vern.cc", "ruraldictionary.esmailelbob.xyz"],
  45.   "stackoverflow.com": ["code.whatever.social", "ao.vern.cc", "overflow.smnz.de", "anonymousoverflow.esmailelbob.xyz", "overflow.adminforge.de", "overflow.hostux.net"],
  46.     //  "ao.foss.wtf",
  47.   "www.goodreads.com": ["biblioreads.ml", "bl.vern.cc", "biblioreads.esmailelbob.xyz"],
  48.   "www.snopes.com": ["sd.vern.cc", "suds.esmailelbob.xyz"],
  49. //  "www.google.com": ["whoogle.hostux.net", "wg.vern.cc", "whoogle.privacydev.net", "whoogle.dcs0.hu", "search.sethforprivacy.com"],
  50.   "en.wikipedia.org": ["wiki.froth.zone", "wikiless.northboot.xyz", "wl.vern.cc", "wikiless.org"],
  51.     // "wikiless.esmailelbob.xyz",
  52.   "en.m.wikipedia.org": ["wiki.froth.zone", "wikiless.northboot.xyz", "wl.vern.cc", "wikiless.org"],
  53.   "de.wikipedia.org": ["wiki.adminforge.de"],
  54.   "www.instructables.com": ["destructables.esmailelbob.xyz"],
  55.   "www.reuters.com": ["neuters.de", "neuters.esmailelbob.xyz"],
  56.   "scratch.mit.edu": ["scratchgui.esmailelbob.xyz", "scratch.machinelearningforkids.co.uk"],
  57.   "odysee.com": ["lbry.projectsegfau.lt", "librarian.esmailelbob.xyz"],
  58.   "yiffer.xyz": ["yiffest.programmerpony.com"],
  59.   "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"],
  60.   "quizlet.com": ["requiz.net"],
  61.   "amazon.com": ["simpleamazon.esmailelbob.xyz", "amazon.simple-web.org"],
  62. //  "github.com": ["gh.odyssey346.dev", "gh.riverside.rocks", "gh.vern.cc", "gh.akisblack.dev", "gh.phreedom.club"],
  63. //  "akkoma.social": ["bdx.town"],
  64. //  "tankerkoenig.de": ["petrolpricesv2.netlify.app"],
  65. //
  66. //  Valid alternatives where end user loses nothing, not frontends
  67. //
  68. //  "www.speedtest.net": ["openspeedtest.com"]
  69. //  "music.apple.com": ["cider.sh"],
  70. //  "www.noisli.com": ["noizee.esmailelbob.xyz"],
  71. };
  72.  
  73. const replaceUrl = (url) => {
  74.   const { host, pathname } = new URL(url);
  75.   if (host === 'genius.com' && pathname.endsWith('-lyrics')) {
  76.     const randomHost = ['dm.vern.cc', 'sing.whatever.social'][Math.floor(Math.random() * 0.5)];
  77.     return url.replace(host, randomHost);
  78.   } else if (host in hosts) {
  79.     let replacement = hosts[host];
  80.     if (Array.isArray(replacement)) {
  81.       replacement = replacement[Math.floor(Math.random() * replacement.length)];
  82.     }
  83.     return url.replace(host, replacement);
  84.   }
  85.   return url;
  86. };
  87.  
  88. try {
  89.   const replacement = hosts[hostname];
  90.   if (replacement) {
  91.     const newUrl = replaceUrl(window.location.href);
  92.     if (newUrl !== window.location.href) {
  93.       window.location.replace(newUrl);
  94.     }
  95.   } else if (hostname === "genius.com" && window.location.pathname.endsWith("-lyrics")) {
  96.     const randomHost = ["dm.vern.cc", "sing.whatever.social"][Math.floor(Math.random() * 0.5)];
  97.     window.location.hostname = randomHost;
  98.   } else if (hostname.endsWith('.bandcamp.com')) {
  99.     const randomTentDomain = ["tn.vern.cc", "tent.bloat.cat", "tent.sny.sh"][Math.floor(Math.random() * 3)];
  100.       //tent.bloatcat.tk
  101.     const subdomain = hostname.slice(0, -'.bandcamp.com'.length);
  102.     const path = window.location.pathname.split('/');
  103.     if (path[1] === 'search') {
  104.       const newUrl = `https://${randomTentDomain}/search.php?query=${path[2]}`;
  105.       if (newUrl !== window.location.href) {
  106.         window.location.replace(newUrl);
  107.       }
  108.     } else if (path[1] === 'img') {
  109.       const newUrl = `https://${randomTentDomain}/image.php?file=${path[2]}`;
  110.       if (newUrl !== window.location.href) {
  111.         window.location.replace(newUrl);
  112.       }
  113.     } else if (path[1] === 'stream') {
  114.       const [_, directory, format, file, token] = path;
  115.       const newUrl = `https://${randomTentDomain}/audio.php?directory=${directory}&format=${format}&file=${file}&token=${token}`;
  116.       if (newUrl !== window.location.href) {
  117.         window.location.replace(newUrl);
  118.       }
  119.     } else {
  120.       const newUrl = `https://${randomTentDomain}/release.php?artist=${subdomain}&type=${path[1]}&name=${path[2]}`;
  121.       if (newUrl !== window.location.href) {
  122.         window.location.replace(newUrl);
  123.       }
  124.     }
  125.   }
  126. } catch (error) {
  127.   console.error(error.message);
  128. }
  129.  
  130. window.addEventListener("load", function () {
  131.   try {
  132.     const iframes = document.querySelectorAll(`iframe[src*="${window.location.host}"]`);
  133.     iframes.forEach(iframe => {
  134.       const newIframe = document.createElement('iframe');
  135.       const attributes = ['src', 'width', 'height', 'frameborder', 'allowfullscreen', 'allow', 'title'];
  136.       attributes.forEach(attribute => {
  137.         if (iframe.hasAttribute(attribute)) {
  138.           newIframe.setAttribute(attribute, iframe.getAttribute(attribute));
  139.         }
  140.       });
  141.       iframe.parentNode.replaceChild(newIframe, iframe);
  142.     });
  143.     const links = document.querySelectorAll("a");
  144.     links.forEach(link => {
  145.       const href = link.href;
  146.       const newUrl = replaceUrl(href);
  147.       if (newUrl !== href) {
  148.         link.href = newUrl;
  149.       }
  150.     });
  151.   } catch (error) {
  152.     console.error(error.message);
  153.   }
  154. });
Advertisement
Comments
  • jncosideout
    192 days
    # text 0.18 KB | 0 0
    1. I had to delete ` "www.xvideos.com": ["porninvidious.esmailelbob.xyz"],` because "Pastebin’s SMART filters have detected potentially offensive or questionable content in your Paste."
Add Comment
Please, Sign In to add comment
Advertisement