Privacy Frontend Redirect

Redirect to privacy friendly front-ends of popular services.

当前为 2023-01-31 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Privacy Frontend Redirect
  3. // @match *://*/*
  4. // @grant none
  5. // @version 3.0.0
  6. // @author NoUser
  7. // @description Redirect to privacy friendly front-ends of popular services.
  8. // @run-at document-start
  9. // @namespace https://greasyfork.org/en/scripts/458875-privacy-frontend-redirect
  10. // @homepage https://greasyfork.org/en/scripts/458875-privacy-frontend-redirect
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. const hostname = window.location.hostname;
  15. const hosts = {
  16. "www.youtube.com": "inv.librefront.com",
  17. "www.youtube-nocookie.com": "inv.librefront.com",
  18. "m.youtube.com": "inv.librefront.com",
  19. "twitter.com": ["nitter.sneed.network", "canada.unofficialbird.com", "nitter.privacytools.io", "nitter.foss.wtf", "nitter.privacy.com.de", "nitter.1d4.us", "nitter.pussthecat.org", "nitter.poast.org", "twitter.censors.us"],
  20. "mobile.twitter.com": ["nitter.sneed.network", "canada.unofficialbird.com", "nitter.privacytools.io", "nitter.foss.wtf", "nitter.privacy.com.de", "nitter.1d4.us", "nitter.pussthecat.org", "nitter.poast.org", "twitter.censors.us"],
  21. "www.reddit.com": ["libreddit.eu.org", "libreddit.spike.codes", "lr.odyssey346.dev", "rd.funami.tech", "libreddit.dcs0.hu", "lr.vern.cc", "www.troddit.com"],
  22. "imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  23. "i.imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  24. "www.instagram.com": ["bibliogram.froth.zone", "ig.tokhmi.xyz", "bibliogram.priv.pw"],
  25. "www.tiktok.com": ["proxitok.pussthecat.org", "proxitok.esmailelbob.xyz", "tok.habedieeh.re", "tok.artemislena.eu", "proxitok.privacydev.net", "proxitok.manasiwibi.com"],
  26. "www.imdb.com": ["ld.vern.cc", "libremdb.esmailelbob.xyz", "lmdb.tokhmi.xyz", "libremdb.iket.me", "libremdb.pussthecat.org"],
  27. "translate.google.com": ["lingva.ml", "translate.plausibility.cloud", "lingva.lunar.icu", "translate.projectsegfau.lt", "translate.jae.fi"],
  28. "medium.com": ["scribe.rip", "scribe.nixnet.services", "scribe.citizen4.eu", "scribe.bus-hit.me", "scribe.froth.zone", "scribe.rawbit.ninja"],
  29. };
  30.  
  31. // Check if hostname exists in the "hosts" object
  32. if (hostname in hosts) {
  33. let replacement = hosts[hostname];
  34.  
  35. // If the replacement value is an array, randomly select one of the frontends
  36. if (Array.isArray(replacement)) {
  37. replacement = replacement[Math.floor(Math.random() * replacement.length)];
  38. }
  39.  
  40. // Replace hostname with selected replacement in the URL
  41. window.location.href = window.location.href.replace(hostname, replacement);
  42. }
  43.  
  44. // Also replace iframes
  45. const iframes = document.getElementsByTagName("iframe");
  46. for (let i = 0; i < iframes.length; i++) {
  47. let iframe = iframes[i];
  48. let src = iframe.src;
  49. let url = new URL(src);
  50. let host = url.host;
  51. if (host in hosts) {
  52. let replacement = hosts[host];
  53. if (Array.isArray(replacement)) {
  54. replacement = replacement[Math.floor(Math.random() * replacement.length)];
  55. }
  56. iframe.src = src.replace(host, replacement);
  57. }
  58. }