Redirecting2Frontend

This script links to the frontend of prominent services including YouTube, Twitter, Reddit, Imgur, Instagram, and TikTok. Updated from older script and reworked for newer frontends/frontend changes

目前为 2024-11-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Redirecting2Frontend
  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. // @license MIT
  10. // @grant none
  11. // @version 1.2
  12. // @description This script links to the frontend of prominent services including YouTube, Twitter, Reddit, Imgur, Instagram, and TikTok. Updated from older script and reworked for newer frontends/frontend changes
  13. // @run-at document-start
  14. // @namespace https://greasyfork.org/users/1401273
  15. // ==/UserScript==
  16.  
  17. const hostname = window.location.hostname;
  18. const hosts = {
  19. "en.wikipedia.org": ["wiki.froth.zone", "wikiless.esmailelbob.xyz", "wikiless.northboot.xyz", "wl.vern.cc"],
  20. "i.imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  21. "i.stack.imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],//
  22. "imgur.com": ["rimgo.pussthecat.org", "rimgo.totaldarkness.net", "rimgo.vern.cc", "imgur.artemislena.eu", "rimgo.privacydev.net", "rimgo.bus-hit.me"],
  23. "m.youtube.com": ["inv.nadeko.net", "invidious.nerdvpn.de"],
  24. "medium.com": ["scribe.rip", "scribe.nixnet.services", "scribe.citizen4.eu", "scribe.bus-hit.me", "scribe.froth.zone", "scribe.rawbit.ninja"],
  25. "mobile.x.com": ["xcancel.com", "twstalker.com", "nitter.poast.org"],
  26. "music.youtube.com": ["hyperpipe.surge.sh", "hyperpipe.drgns.space", "hp.iqbalrifai.eu.org", "hyperpipe.projectsegfau.lt"],
  27. "odysee.com": ["lbry.projectsegfau.lt", "librarian.esmailelbob.xyz", "lbry.us.projectsegfau.lt", "lbry.ramondia.net"],
  28. "old.reddit.com": ["photon-reddit.com", "lr.vern.cc", "snoo.habedieeh.re", "reddit.rtrace.io"],
  29. "stackoverflow.com": ["code.whatever.social", "ao.vern.cc", "overflow.adminforge.de", "ao.foss.wtf", "overflow.hostux.net"],
  30. "translate.google.com": ["tl.vern.cc", "translate.slipfox.xyz"],
  31. "www.goodreads.com": ["read.canine.tools", "biblioreads.ducks.party", "read.freedit.eu", "biblioreads.lunar.icu", "biblioreads.eu.org"],
  32. "www.imdb.com": ["ld.vern.cc", "libremdb.esmailelbob.xyz", "lmdb.tokhmi.xyz", "libremdb.iket.me", "libremdb.pussthecat.org"],
  33. "www.instagram.com": ["www.piokok.com"],
  34. "www.instructables.com": ["destructables.esmailelbob.xyz"],
  35. "www.pinterest.com": ["librerest.bunk.lol", "binternet.ahwx.org", "bn.bloat.cat", "bn.opnxng.com"],
  36. "www.quora.com": ["quetre.pussthecat.org", "quetre.gitro.xyz", "quetre.canine.tools", "quetre.r4fo.com"],
  37. "www.reddit.com": ["photon-reddit.com", "lr.vern.cc", "snoo.habedieeh.re", "reddit.rtrace.io"],
  38. "www.reuters.com": ["neuters.de"],
  39. "www.snopes.com": ["sd.vern.cc", "suds.esmailelbob.xyz"],
  40. "www.tumblr.com": ["pb.bloat.cat","priviblur.thebunny.zone"],
  41. "www.tiktok.com": ["proxitok.pabloferreiro.es", "www.offtiktok.com"],
  42. "www.urbandictionary.com": ["rd.vern.cc"],
  43. "www.wolframalpha.com": ["wolfree.chickenkiller.com", "wolfree.crabdance.com", "wolfree.my.to", "wolfree.netlify.app", "wolfree.onrender.com", "wolfree.strangled.net"],
  44. "www.xvideos.com": ["porninvidious.esmailelbob.xyz"],
  45. "www.youtube-nocookie.com": ["inv.nadeko.net", "invidious.nerdvpn.de"],
  46. // "www.youtube.com": ["inv.nadeko.net", "invidious.nerdvpn.de"],
  47. "x.com": ["xcancel.com", "twstalker.com", "nitter.poast.org"],
  48. };
  49.  
  50. const replaceUrl = (url) => {
  51. const { host, pathname } = new URL(url);
  52. if (host === 'genius.com' && pathname.endsWith('-lyrics')) {
  53. const randomHost = ['dm.vern.cc', 'sing.whatever.social'][Math.floor(Math.random() * 0.5)];
  54. return url.replace(host, randomHost);
  55. } else if (host in hosts) {
  56. let replacement = hosts[host];
  57. if (Array.isArray(replacement)) {
  58. replacement = replacement[Math.floor(Math.random() * replacement.length)];
  59. }
  60. return url.replace(host, replacement);
  61. }
  62. return url;
  63. };
  64.  
  65. try {
  66. const replacement = hosts[hostname];
  67. if (replacement) {
  68. const newUrl = replaceUrl(window.location.href);
  69. if (newUrl !== window.location.href) {
  70. window.location.replace(newUrl);
  71. }
  72. } else if (hostname === "genius.com" && window.location.pathname.endsWith("-lyrics")) {
  73. const randomHost = ["dm.vern.cc", "sing.whatever.social"][Math.floor(Math.random() * 0.5)];
  74. window.location.hostname = randomHost;
  75. } else if (hostname.endsWith('.bandcamp.com')) {
  76. const subdomain = hostname.slice(0, -'.bandcamp.com'.length);
  77. const path = window.location.pathname.split('/');
  78. if (path[1] === 'search') {
  79. const newUrl = `https://tent.bloatcat.tk/search.php?query=${path[2]}`;
  80. if (newUrl !== window.location.href) {
  81. window.location.replace(newUrl);
  82. }
  83. } else if (path[1] === 'img') {
  84. const newUrl = `https://tent.bloatcat.tk/image.php?file=${path[2]}`;
  85. if (newUrl !== window.location.href) {
  86. window.location.replace(newUrl);
  87. }
  88. } else if (path[1] === 'stream') {
  89. const [_, directory, format, file, token] = path;
  90. const newUrl = `https://tent.bloatcat.tk/audio.php?directory=${directory}&format=${format}&file=${file}&token=${token}`;
  91. if (newUrl !== window.location.href) {
  92. window.location.replace(newUrl);
  93. }
  94. } else {
  95. const newUrl = `https://tent.bloatcat.tk/release.php?artist=${subdomain}&type=${path[1]}&name=${path[2]}`;
  96. if (newUrl !== window.location.href) {
  97. window.location.replace(newUrl);
  98. }
  99. }
  100. }
  101. } catch (error) {
  102. console.error(error.message);
  103. }
  104.  
  105. window.addEventListener("load", function () {
  106. try {
  107. const iframes = document.querySelectorAll(`iframe[src*="${window.location.host}"]`);
  108. iframes.forEach(iframe => {
  109. const newIframe = document.createElement('iframe');
  110. const attributes = ['src', 'width', 'height', 'frameborder', 'allowfullscreen', 'allow', 'title'];
  111. attributes.forEach(attribute => {
  112. if (iframe.hasAttribute(attribute)) {
  113. newIframe.setAttribute(attribute, iframe.getAttribute(attribute));
  114. }
  115. });
  116. iframe.parentNode.replaceChild(newIframe, iframe);
  117. });
  118. const links = document.querySelectorAll("a");
  119. links.forEach(link => {
  120. const href = link.href;
  121. const newUrl = replaceUrl(href);
  122. if (newUrl !== href) {
  123. link.href = newUrl;
  124. }
  125. });
  126. } catch (error) {
  127. console.error(error.message);
  128. }
  129. });