隐私重定向器

将社交媒体平台重定向到其隐私友好的首页

目前为 2023-08-23 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Privacy Redirector
  3. // @name:bg Пренасочване на поверителността
  4. // @name:br Rediretor de privacidade
  5. // @name:cs Přesměrování soukromí
  6. // @name:de Datenschutz Umleiter
  7. // @name:da Omdirigeringsenhed for privatlivets fred
  8. // @name:et Privaatsuse ümbersuunaja
  9. // @name:es Redirección de privacidad
  10. // @name:fi Yksityisyydensuojan uudelleenohjaus
  11. // @name:fr Redirecteur de confidentialité
  12. // @name:el Επανακατευθυντής απορρήτου
  13. // @name:hu Adatvédelmi átirányító
  14. // @name:id Pengarah Privasi
  15. // @name:it Reindirizzatore di privacy
  16. // @name:ja プライバシーリダイレクト
  17. // @name:lt Privatumo nukreipiklis
  18. // @name:lv Konfidencialitātes pāradresētājs
  19. // @name:nl Privacy-omleiding
  20. // @name:pl Przekierownik prywatności
  21. // @name:pt Redirector de Privacidade
  22. // @name:ro Redirector de confidențialitate
  23. // @name:ru Перенаправление конфиденциальности
  24. // @name:sv Omdirigering av sekretess
  25. // @name:sl Preusmerjevalnik zasebnosti
  26. // @name:sk Presmerovanie súkromia
  27. // @name:tr Gizlilik Yönlendiricisi
  28. // @name:uk Редиректор конфіденційності
  29. // @name:zh 隐私重定向器
  30. // @name:zh-CN 隐私重定向器
  31. // @description Redirect social media platforms to their privacy respecting frontends
  32. // @description:bg Пренасочване на платформите за социални медии към заглавните им страници, съобразени с поверителността
  33. // @description:br Redirecionando as plataformas de mídia social para suas primeiras páginas de privacidade
  34. // @description:cs Přesměrování platforem sociálních médií na jejich titulní stránky šetrné k soukromí
  35. // @description:de Leitet von Social-Media-Plattformen auf deren jeweilige datenschutzfreundlicheren Frontends
  36. // @description:da Omdirigering af sociale medieplatforme til deres privatlivsvenlige forsider
  37. // @description:et Sotsiaalmeediaplatvormide ümbersuunamine nende privaatsussõbralikele esilehtedele
  38. // @description:es Redirigir las plataformas de medios sociales a sus portadas respetuosas con la privacidad
  39. // @description:fi Sosiaalisen median alustojen ohjaaminen yksityisyyden suojaa edistäville etusivuille.
  40. // @description:fr Rediriger les plateformes de médias sociaux vers leurs pages d'accueil respectueuses de la vie privée
  41. // @description:el Αναπροσανατολισμός των πλατφορμών κοινωνικής δικτύωσης στις μπροστινές σελίδες τους που είναι φιλικές προς το απόρρητο
  42. // @description:hu A közösségi médiaplatformok átirányítása az adatvédelem-barát kezdőlapokra
  43. // @description:id Mengarahkan platform media sosial ke halaman depan yang ramah privasi
  44. // @description:it Reindirizzare le piattaforme di social media verso le loro pagine frontali che rispettano la privacy
  45. // @description:ja ソーシャルメディアプラットフォームをプライバシーに配慮したフロントページにリダイレクトする
  46. // @description:lt Socialinės žiniasklaidos platformų nukreipimas į privatumą užtikrinančius pirmuosius puslapius
  47. // @description:lv Sociālo plašsaziņas līdzekļu platformu pāradresēšana uz to privātumam draudzīgajām pirmajām lapām.
  48. // @description:nl Sociale-mediaplatforms omleiden naar hun privacyvriendelijke voorpagina's
  49. // @description:pl Przekierowanie platform mediów społecznościowych na ich przyjazne dla prywatności strony tytułowe
  50. // @description:pt Redireccionar as plataformas de redes sociais para as suas primeiras páginas amigas da privacidade
  51. // @description:ro Redirecționarea platformelor de socializare către paginile lor de început care respectă viața privată
  52. // @description:ru Перенаправление платформ социальных сетей на их главные страницы, дружественные к конфиденциальности
  53. // @description:sv Omdirigera sociala medieplattformar till deras integritetsvänliga förstasidor.
  54. // @description:sl preusmeritev platform družabnih medijev na njihove naslovne strani, ki so prijazne do zasebnosti.
  55. // @description:sk Presmerovanie platforiem sociálnych médií na ich úvodné stránky, ktoré chránia súkromie
  56. // @description:tr Sosyal medya platformlarını, gizliliğe saygı duyan önyüzlerine yönlendirir
  57. // @description:uk Перенаправлення соціальних медіа-платформ на їхні головні сторінки, дружні до приватності
  58. // @description:zh 将社交媒体平台重定向到其隐私友好的首页
  59. // @description:zh-CN 将社交媒体平台重定向到其隐私友好的首页
  60. // @namespace https://github.com/dybdeskarphet/privacy-redirector
  61. // @author Ahmet Arda Kavakcı
  62. // @license GPLv3
  63. // @version 1.4.8
  64. // @supportURL https://github.com/dybdeskarphet/privacy-redirector
  65. // @run-at document-start
  66. // @match *://*.bandcamp.com/*
  67. // @match *://*.fandom.com/*
  68. // @match *://*.genius.com/*
  69. // @match *://*.google.com/*
  70. // @match *://*.imdb.com/*
  71. // @match *://*.imgur.com/*
  72. // @match *://*.instagram.com/*
  73. // @match *://*.medium.com/*
  74. // @match *://*.pinterest.com/*
  75. // @match *://i.pinimg.com/*
  76. // @match *://*.quora.com/*
  77. // @match *://*.reddit.com/*
  78. // @match *://*.reuters.com/*
  79. // @match *://*.tiktok.com/*
  80. // @match *://*.twitter.com/*
  81. // @match *://*.wikipedia.org/*
  82. // @match *://*.youtube-nocookie.com/*
  83. // @match *://*.youtube.com/*
  84. // @match *://*.soundcloud.com/*
  85. // @match *://f4.bcbits.com/*
  86. // @match *://genius.com/*
  87. // @match *://imgur.com/*
  88. // @match *://instagram.com/*
  89. // @match *://medium.com/*
  90. // @match *://news.ycombinator.com/*
  91. // @match *://reddit.com/*
  92. // @match *://stackoverflow.com/*
  93. // @match *://t4.bcbits.com/*
  94. // @match *://translate.google.com/*
  95. // @match *://twitter.com/*
  96. // @match *://www.goodreads.com/*
  97. // @match *://youtube.com/*
  98. // ==/UserScript==
  99.  
  100. /*
  101. ___ _ _ ___ _____ _____
  102. / _ \| \ | | / _ \| ___| ___|
  103. | | | | \| |_____| | | | |_ | |_
  104. | |_| | |\ |_____| |_| | _| | _|
  105. \___/|_| \_| \___/|_| |_|
  106.  
  107. CHANGE THE RELEVANT VALUE TO "false" TO
  108. DISABLE THE REDIRECTION/FARSIDE FOR THAT
  109. PARTICULAR PLATFORM */
  110.  
  111. // REDIRECTON / FARSIDE
  112.  
  113. let bandcamp = [true, true];
  114. let fandom = [true, true];
  115. let genius = [true, true];
  116. let goodreads = [true, false];
  117. let google = [true, true];
  118. let gtranslate = [true, true];
  119. let hackernews = [true, true];
  120. let imdb = [true, true];
  121. let imgur = [true, true];
  122. let medium = [true, true];
  123. let pinterest = [true, true];
  124. let quora = [true, true];
  125. let reddit = [true, true];
  126. let reuters = [true, true];
  127. let soundcloud = [true, true];
  128. let stackoverflow = [true, true];
  129. let tiktok = [true, true];
  130. let twitter = [true, true];
  131. let wikipedia = [true, true];
  132. let youtube = [true, true];
  133. // REDIRECTON / FARSIDE / WARNING
  134. let instagram = [true, false, true];
  135.  
  136. // PREFERRED FRONTEND
  137. let youtubeFrontend = "piped"; // accepts "invidious", "piped", "tubo"
  138. let youtubeMusicFrontend = "beatbump"; // accepts "beatbump", "invidious", "piped"
  139. let redditFrontend = "libreddit"; // accepts "libreddit", "teddit"
  140. let googleFrontend = "searxng"; // accepts "searx", "searxng"
  141. let geniusFrontend = "intellectual"; // accept dumb, intellectual
  142.  
  143. // OTHER SETTINGS
  144. let keepHistory = false; // keeps farside.link in the browser history
  145.  
  146. // // // // // // // // // // // // //
  147.  
  148. /*
  149. ___ _
  150. |_ _|_ __ ___| |_ __ _ _ __ ___ ___ ___
  151. | || '_ \/ __| __/ _` | '_ \ / __/ _ \/ __|
  152. | || | | \__ \ || (_| | | | | (_| __/\__ \
  153. |___|_| |_|___/\__\__,_|_| |_|\___\___||___/
  154.  
  155. LIST OF INSTANCES TO USE IF FARSIDE IS NOT ENABLED
  156. */
  157.  
  158. let anonymousoverflowInstances = [
  159. "code.whatever.social",
  160. "ao.vern.cc",
  161. "overflow.smnz.de",
  162. "overflow.lunar.icu",
  163. ];
  164.  
  165. let beatbumpInstances = ["beatbump.ml", "bb.eu.projectsegfau.lt"];
  166.  
  167. let bibliogramInstances = ["ig.tokhmi.xyz", "bibliogram.froth.zone"];
  168.  
  169. let biblioreadsInstances = [
  170. "biblioreads.ml",
  171. "biblioreads.ga",
  172. "biblioreads.netlify.app",
  173. ];
  174.  
  175. let binternetInstances = [
  176. "binternet.ahwx.org",
  177. "binternet.revvy.de",
  178. "binternet.bloatcat.tk",
  179. "bn.vern.cc",
  180. "pinterest.foxhaven.cyou",
  181. ];
  182.  
  183. let breezewikiInstances = [
  184. "breezewiki.com",
  185. "breezewiki.pussthecat.org",
  186. "antifandom.com",
  187. "bw.hamstro.dev",
  188. ];
  189.  
  190. let dumbInstances = [
  191. "dm.vern.cc",
  192. "sing.whatever.social",
  193. "dumb.lunar.icu",
  194. "dumb.privacydev.net",
  195. ];
  196.  
  197. let intellectualInstances = ["intellectual.insprill.net"];
  198.  
  199. let invidiousInstances = [
  200. "yewtu.be",
  201. "vid.puffyan.us",
  202. "yt.artemislena.eu",
  203. "invidious.projectsegfau.lt",
  204. ];
  205.  
  206. let pipedInstances = [
  207. "pipedapi.video",
  208. "pipedapi.tokhmi.xyz",
  209. "piped.projectsegfau.lt",
  210. "piped.privacydev.net",
  211. ];
  212.  
  213. let libredditInstances = [
  214. "libreddit.invak.id",
  215. "libreddit.de",
  216. "libreddit.kavin.rocks",
  217. "libreddit.kutay.dev",
  218. ];
  219.  
  220. let libremdbInstances = [
  221. "libremdb.pussthecat.org",
  222. "libremdb.iket.me",
  223. "libremdb.lunar.icu",
  224. "binge.whatever.social",
  225. ];
  226.  
  227. let lingvaInstances = [
  228. "lingva.ml",
  229. "translate.igna.wtf",
  230. "translate.plausibility.cloud",
  231. "translate.projectsegfau.lt",
  232. ];
  233.  
  234. let nitterInstances = [
  235. "nitter.lacontrevoie.fr",
  236. "nitter.fdn.fr",
  237. "nitter.1d4.us",
  238. "nitter.kavin.rocks",
  239. ];
  240.  
  241. let proxitokInstances = [
  242. "proxitok.pabloferreiro.es",
  243. "proxitok.privacydev.net",
  244. "proxitok.pussthecat.org",
  245. ];
  246.  
  247. let quetreInstances = [
  248. "quetre.iket.me",
  249. "quora.vern.cc",
  250. "quetre.pussthecat.org",
  251. "quetre.tokhmi.xyz",
  252. ];
  253.  
  254. let rimgoInstances = [
  255. "rimgo.pussthecat.org",
  256. "rimgo.totaldarkness.net",
  257. "rimgo.bus-hit.me",
  258. "imgur.artemislena.eu",
  259. ];
  260.  
  261. let scribeInstances = [
  262. "scribe.rip",
  263. "scribe.nixnet.services",
  264. "scribe.citizen4.eu",
  265. "scribe.bus-hit.me",
  266. ];
  267.  
  268. let tedditInstances = [
  269. "teddit.pussthecat.org",
  270. "teddit.ggc-project.de",
  271. "teddit.domain.glass",
  272. "teddit.zaggy.nl",
  273. ];
  274.  
  275. let tentInstances = ["tent.sny.sh", "tent.bloatcat.tk", "tn.vern.cc"];
  276.  
  277. let tuboInstances = ["tubo.migalmoreno.com"];
  278.  
  279. let wikilessInstances = [
  280. "wikiless.org",
  281. "wikiless.tiekoetter.com",
  282. "wikiless.funami.tech",
  283. "wl.vern.cc",
  284. ];
  285.  
  286. let searxInstances = [
  287. "search.bus-hit.me",
  288. "search.projectsegfau.lt",
  289. "northboot.xyz",
  290. "opnxng.com",
  291. ];
  292.  
  293. let searxngInstances = [
  294. "baresearch.org",
  295. "dynabyte.ca",
  296. "search.bus-hit.me",
  297. "search.leptons.xyz",
  298. ];
  299.  
  300. let farsideInstance = "farside.link";
  301.  
  302. // // // // // // // // // // // // //
  303.  
  304. let debug_mode = false;
  305.  
  306. if (debug_mode == true) {
  307. alert(
  308. "\n== DEBUG MODE IS ON ==" +
  309. "\nIf you're seeing this" +
  310. "\nset the debug_mode value to" +
  311. "\nfalse for Privacy Redirctor." +
  312. "\n======================" +
  313. "\n\nHostname: " +
  314. window.location.hostname +
  315. "\nPath: " +
  316. window.location.pathname +
  317. "\nQuery: " +
  318. window.location.search +
  319. "\nHash: " +
  320. window.location.hash
  321. );
  322. }
  323.  
  324. if (keepHistory == true) farsideInstance = farsideInstance + "/_";
  325.  
  326. function redirectInstagram() {
  327. if (instagram[0] == true) {
  328. var selectedInstance = "";
  329. var newPathName = "";
  330. var newQuery = "";
  331. var tempURL = "";
  332.  
  333. function displayWarning() {
  334. if (instagram[2] == true) {
  335. alert(
  336. "Bibliogram is discontinued, you may want to disable the redirection." +
  337. "\n\nIf you don't want to see this warning, set Instagram's 'WARNING' to 'false' or set 'REDIRETON' to 'false' to turn off the Instagram redirect completely."
  338. );
  339. }
  340. }
  341.  
  342. if (instagram[1] == false) {
  343. selectedInstance =
  344. bibliogramInstances[
  345. Math.floor(Math.random() * bibliogramInstances.length)
  346. ];
  347. } else {
  348. selectedInstance = `${farsideInstance}/bibliogram`;
  349. }
  350.  
  351. if (window.location.pathname.startsWith("/accounts/login/")) {
  352. newPathName = window.location.pathname.replace("/accounts/login/", "");
  353. newQuery = window.location.search.replace("?next=", "");
  354. tempURL = `${window.location.protocol}//${selectedInstance}${newPathName}${newQuery}${window.location.hash}`;
  355. } else {
  356. tempURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  357. }
  358.  
  359. if (tempURL.includes("/p/")) {
  360. displayWarning();
  361. window.stop();
  362. let newURL = `${tempURL}`;
  363. window.location.replace(newURL);
  364. } else if (tempURL.includes("/reels/")) {
  365. displayWarning();
  366. window.stop();
  367. let newURL = tempURL.replace("/reels/", "/p/");
  368. window.location.replace(newURL);
  369. }
  370. }
  371. }
  372.  
  373. function redirectTwitter() {
  374. if (twitter[0] == true) {
  375. window.stop();
  376.  
  377. var selectedInstance = "";
  378. var newPathName = "";
  379. var newQuery = "";
  380.  
  381. if (twitter[1] == false) {
  382. selectedInstance =
  383. nitterInstances[Math.floor(Math.random() * nitterInstances.length)];
  384. } else {
  385. selectedInstance = `${farsideInstance}/nitter`;
  386. }
  387.  
  388. if (window.location.pathname.startsWith("/i/flow/login")) {
  389. newPathName = window.location.pathname.replace("/i/flow/login", "");
  390. newQuery = window.location.search.replace(
  391. "?redirect_after_login=%2F",
  392. "/"
  393. );
  394. let newURL = `${window.location.protocol}//${selectedInstance}${newPathName}${newQuery}${window.location.hash}`;
  395. window.location.replace(newURL);
  396. } else {
  397. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  398. window.location.replace(newURL);
  399. }
  400. }
  401. }
  402.  
  403. function redirectReddit() {
  404. if (reddit[0] == true) {
  405. window.stop();
  406. var selectedInstance = "";
  407.  
  408. if (reddit[1] == false) {
  409. selectedInstance = eval(redditFrontend + "Instances")[
  410. Math.floor(Math.random() * eval(redditFrontend + "Instances.length"))
  411. ];
  412. } else {
  413. selectedInstance = `${farsideInstance}/${redditFrontend}`;
  414. }
  415.  
  416. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  417.  
  418. window.location.replace(newURL);
  419. }
  420. }
  421.  
  422. function redirectYoutube() {
  423. if (youtube[0] == true) {
  424. window.stop();
  425. var selectedInstance = "";
  426.  
  427. if (youtubeFrontend != "tubo") {
  428. if (youtube[1] == false) {
  429. selectedInstance = eval(youtubeFrontend + "Instances")[
  430. Math.floor(Math.random() * eval(youtubeFrontend + "Instances.length"))
  431. ];
  432. } else {
  433. selectedInstance = `${farsideInstance}/${youtubeFrontend}`;
  434. }
  435.  
  436. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  437.  
  438. window.location.replace(newURL);
  439. } else {
  440. selectedInstance =
  441. tuboInstances[Math.floor(Math.random() * tuboInstances.length)];
  442.  
  443. if (
  444. window.location.pathname.startsWith("/@") ||
  445. window.location.pathname.startsWith("/channel")
  446. ) {
  447. let newURL = `${window.location.protocol}//${selectedInstance}/channel?url=${window.location.href}`;
  448. window.location.replace(newURL);
  449. } else {
  450. let newURL = `${window.location.protocol}//${selectedInstance}/stream?url=${window.location.href}`;
  451. window.location.replace(newURL);
  452. }
  453. }
  454. }
  455. }
  456.  
  457. function redirectTiktok() {
  458. if (tiktok[0] == true) {
  459. window.stop();
  460. var selectedInstance = "";
  461.  
  462. if (tiktok[1] == false) {
  463. selectedInstance =
  464. proxitokInstances[Math.floor(Math.random() * proxitokInstances.length)];
  465. } else {
  466. selectedInstance = `${farsideInstance}/proxitok`;
  467. }
  468.  
  469. if (window.location.pathname.startsWith("/discover")) {
  470. let newURL = `${
  471. window.location.protocol
  472. }//${selectedInstance}${window.location.pathname.replace(
  473. "discover",
  474. "tag"
  475. )}${window.location.hash}`;
  476.  
  477. window.location.replace(newURL);
  478. } else if (
  479. window.location.pathname.search(/[a-z][a-z]\-[A-Z][A-Z]/g) != -1
  480. ) {
  481. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  482.  
  483. window.location.replace(newURL);
  484. } else {
  485. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  486.  
  487. window.location.replace(newURL);
  488. }
  489. }
  490. }
  491.  
  492. function redirectImgur() {
  493. if (imgur[0] == true) {
  494. window.stop();
  495.  
  496. var selectedInstance = "";
  497.  
  498. if (imgur[1] == false) {
  499. selectedInstance =
  500. rimgoInstances[Math.floor(Math.random() * rimgoInstances.length)];
  501. } else {
  502. selectedInstance = `${farsideInstance}/rimgo`;
  503. }
  504.  
  505. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  506.  
  507. window.location.replace(newURL);
  508. }
  509. }
  510.  
  511. function redirectMedium() {
  512. if (medium[0] == true || window.location.pathname != "/") {
  513. window.stop();
  514. var selectedInstance = "";
  515.  
  516. if (medium[1] == false) {
  517. selectedInstance =
  518. scribeInstances[Math.floor(Math.random() * scribeInstances.length)];
  519. } else {
  520. selectedInstance = `${farsideInstance}/scribe`;
  521. }
  522.  
  523. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  524.  
  525. window.location.replace(newURL);
  526. }
  527. }
  528.  
  529. function redirectYoutubeMusic() {
  530. if (youtube[0] == true) {
  531. window.stop();
  532.  
  533. var beatbumpInstance =
  534. beatbumpInstances[Math.floor(Math.random() * beatbumpInstances.length)];
  535.  
  536. if (window.location.pathname.startsWith("/watch")) {
  537. if (youtube[1] == false) {
  538. selectedInstance = eval(youtubeFrontend + "Instances")[
  539. Math.floor(Math.random() * eval(youtubeFrontend + "Instances.length"))
  540. ];
  541. } else {
  542. selectedInstance = `${farsideInstance}/${youtubeFrontend}`;
  543. }
  544.  
  545. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  546.  
  547. window.location.replace(newURL);
  548. } else {
  549. let newURL = `${window.location.protocol}//${beatbumpInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  550. window.location.replace(newURL);
  551. }
  552. }
  553. }
  554.  
  555. function redirectHackerNews() {
  556. if (
  557. hackernews[0] == true &&
  558. window.location.pathname != "/user" &&
  559. window.location.pathname != "/item"
  560. ) {
  561. window.stop();
  562. let newURL = `${window.location.protocol}//hn.algolia.com`;
  563. window.location.replace(newURL);
  564. }
  565. }
  566.  
  567. function redirectGTranslate() {
  568. if (gtranslate[0] == true) {
  569. window.stop();
  570. var selectedInstance = "";
  571.  
  572. if (gtranslate[1] == false) {
  573. selectedInstance =
  574. lingvaInstances[Math.floor(Math.random() * lingvaInstances.length)];
  575. } else {
  576. selectedInstance = `${farsideInstance}/lingva`;
  577. }
  578.  
  579. if (window.location.search != "") {
  580. let newURL =
  581. window.location.protocol +
  582. "//" +
  583. selectedInstance +
  584. window.location.pathname +
  585. window.location.search
  586. .replace(/\?hl=tr/, "")
  587. .replace(/.sl=/, "")
  588. .replace("&tl=", "/")
  589. .replace("&text=", "/")
  590. .replace("&op=translate", "") +
  591. window.location.hash;
  592.  
  593. window.location.replace(newURL);
  594. } else {
  595. let newURL = window.location.protocol + "//" + selectedInstance;
  596. window.location.replace(newURL);
  597. }
  598. }
  599. }
  600.  
  601. function redirectReuters() {
  602. if (reuters[0] == true) {
  603. window.stop();
  604. location.hostname = "neuters.de";
  605. }
  606. }
  607.  
  608. function redirectWikipedia() {
  609. if (wikipedia[0] == true) {
  610. window.stop();
  611. let langCodeIndex = window.location.hostname.search(/^[a-z][a-z]\./);
  612. var selectedInstance = "";
  613.  
  614. if (wikipedia[1] == false) {
  615. selectedInstance =
  616. wikilessInstances[Math.floor(Math.random() * wikilessInstances.length)];
  617. } else {
  618. selectedInstance = `${farsideInstance}/wikiless`;
  619. }
  620.  
  621. if (langCodeIndex != -1) {
  622. let newURL =
  623. window.location.protocol +
  624. "//" +
  625. selectedInstance +
  626. window.location.pathname +
  627. "?lang=" +
  628. window.location.hostname[langCodeIndex] +
  629. window.location.hostname[langCodeIndex + 1] +
  630. window.location.hash;
  631. window.location.replace(newURL);
  632. } else {
  633. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}?lang=en${window.location.hash}`;
  634. window.location.replace(newURL);
  635. }
  636. }
  637. }
  638.  
  639. function redirectImdb() {
  640. if (imdb[0] == true) {
  641. window.stop();
  642. var selectedInstance = "";
  643.  
  644. if (imdb[1] == false) {
  645. selectedInstance =
  646. libremdbInstances[Math.floor(Math.random() * libremdbInstances.length)];
  647. } else {
  648. selectedInstance = `${farsideInstance}/libremdb`;
  649. }
  650.  
  651. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  652.  
  653. window.location.replace(newURL);
  654. }
  655. }
  656.  
  657. function redirectQuora() {
  658. if (quora[0] == true) {
  659. window.stop();
  660. var selectedInstance = "";
  661.  
  662. if (quora[1] == false) {
  663. selectedInstance =
  664. quetreInstances[Math.floor(Math.random() * quetreInstances.length)];
  665. } else {
  666. selectedInstance = `${farsideInstance}/quetre`;
  667. }
  668.  
  669. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  670.  
  671. window.location.replace(newURL);
  672. }
  673. }
  674.  
  675. function redirectFandom() {
  676. if (fandom[0] == true) {
  677. let randomInstance =
  678. breezewikiInstances[
  679. Math.floor(Math.random() * breezewikiInstances.length)
  680. ];
  681. let fandomName = window.location.hostname.replace(/\..*/, "");
  682. let newURL = "";
  683. window.stop();
  684.  
  685. if (fandomName !== "www") {
  686. newURL = `${window.location.protocol}//${randomInstance}/${fandomName}${window.location.pathname}${window.location.search}${window.location.hash}`;
  687. } else {
  688. newURL = `${window.location.protocol}//${randomInstance}`;
  689. }
  690.  
  691. window.location.replace(newURL);
  692. }
  693. }
  694.  
  695. function redirectGoogle() {
  696. if (
  697. google[0] == true &&
  698. window.location.hostname.startsWith("www") &&
  699. window.location.pathname.startsWith("/search")
  700. ) {
  701. window.stop();
  702. var selectedInstance = "";
  703.  
  704. if (google[1] == false) {
  705. selectedInstance = eval(googleFrontend + "Instances")[
  706. Math.floor(Math.random() * eval(googleFrontend + "Instances.length"))
  707. ];
  708. } else {
  709. selectedInstance = `${farsideInstance}/${googleFrontend}`;
  710. }
  711.  
  712. if (window.location.pathname.match("/")) {
  713. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  714. window.location.replace(newURL);
  715. } else {
  716. let newURL = `${window.location.protocol}//${selectedInstance}${
  717. window.location.pathname
  718. }${window.location.search.match(/\?q.+?(?=\&)/)}`;
  719. window.location.replace(newURL);
  720. }
  721. }
  722. }
  723.  
  724. function redirectGoodreads() {
  725. if (goodreads[0] == true) {
  726. window.stop();
  727.  
  728. var selectedInstance =
  729. biblioreadsInstances[
  730. Math.floor(Math.random() * biblioreadsInstances.length)
  731. ];
  732.  
  733. if (window.location.pathname.startsWith("/search")) {
  734. let newURL =
  735. `${window.location.protocol}//${selectedInstance}${window.location.pathname}` +
  736. window.location.search.replace(/.*.q\=/, "/") +
  737. `${window.location.hash}`;
  738. window.location.replace(newURL);
  739. } else {
  740. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  741. window.location.replace(newURL);
  742. }
  743. }
  744. }
  745.  
  746. function redirectStackoverflow() {
  747. if (
  748. stackoverflow[0] == true &&
  749. window.location.pathname.startsWith("/questions")
  750. ) {
  751. window.stop();
  752. if (stackoverflow[1] == false) {
  753. selectedInstance =
  754. anonymousoverflowInstances[
  755. Math.floor(Math.random() * anonymousoverflowInstances.length)
  756. ];
  757. } else {
  758. selectedInstance = `${farsideInstance}/anonymousoverflow`;
  759. }
  760.  
  761. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  762. window.location.replace(newURL);
  763. }
  764. }
  765.  
  766. function redirectBandcamp() {
  767. if (bandcamp[0] == true) {
  768. // thanks to libredirect
  769.  
  770. var selectedInstance =
  771. tentInstances[Math.floor(Math.random() * tentInstances.length)];
  772.  
  773. if (
  774. window.location.hostname == "bandcamp.com" &&
  775. window.location.pathname == "/search"
  776. ) {
  777. const query = window.location.searchParams.get("q");
  778. let newURL = `${
  779. window.location.protocol
  780. }//${selectedInstance}/search.php?query=${encodeURIComponent(query)}`;
  781. window.location.replace(newURL);
  782. }
  783.  
  784. if (window.location.hostname.endsWith("bandcamp.com")) {
  785. const regex = /^(.*)\.bandcamp\.com/.exec(window.location.hostname);
  786. const artist = regex[1];
  787. if (window.location.pathname == "/") {
  788. let newURL = `${window.location.protocol}//${selectedInstance}/artist.php?name=${artist}`;
  789. window.location.replace(newURL);
  790. } else {
  791. const regex = /^\/(.*)\/(.*)/.exec(window.location.pathname);
  792. if (regex) {
  793. const type = regex[1];
  794. const name = regex[2];
  795. let newURL = `${window.location.protocol}//${selectedInstance}/release.php?artist=${artist}&type=${type}&name=${name}`;
  796. window.location.replace(newURL);
  797. }
  798. }
  799. }
  800.  
  801. if (window.location.hostname == "f4.bcbits.com") {
  802. const regex = /\/img\/(.*)/.exec(window.location.pathname);
  803. const image = regex[1];
  804. let newURL = `${window.location.protocol}//${selectedInstance}/image.php?file=${image}`;
  805. window.location.replace(newURL);
  806. }
  807.  
  808. if (window.location.hostname == "t4.bcbits.com") {
  809. const regex = /\/stream\/(.*)\/(.*)\/(.*)/.exec(window.location.pathname);
  810. if (regex) {
  811. const directory = regex[1];
  812. const format = regex[2];
  813. const file = regex[3];
  814. const token = window.location.searchParams.get("token");
  815. let newURL = `${
  816. window.location.protocol
  817. }//${selectedInstance}/audio.php/?directory=${directory}&format=${format}&file=${file}&token=${encodeURIComponent(
  818. token
  819. )}`;
  820. window.location.replace(newURL);
  821. }
  822. }
  823. }
  824. }
  825.  
  826. function redirectGenius() {
  827. if (genius[0] == true) {
  828. switch (geniusFrontend) {
  829. case "dumb":
  830. window.stop();
  831. var selectedInstance =
  832. dumbInstances[Math.floor(Math.random() * dumbInstances.length)];
  833.  
  834. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  835. window.location.replace(newURL);
  836. break;
  837. case "intellectual":
  838. var selectedInstance =
  839. intellectualInstances[
  840. Math.floor(Math.random() * intellectualInstances.length)
  841. ];
  842.  
  843. if (window.location.pathname.endsWith("-lyrics")) {
  844. window.stop();
  845. selectedInstance = selectedInstance + "/lyrics?path=";
  846. let newURL = `${window.location.protocol}//${selectedInstance}${window.location.pathname}${window.location.search}${window.location.hash}`;
  847. window.location.replace(newURL);
  848. } else if (window.location.pathname.startsWith("/albums")) {
  849. window.stop();
  850. let newURL =
  851. `${window.location.protocol}//${selectedInstance}` +
  852. `${window.location.pathname}${window.location.search}`.replace(
  853. "/albums",
  854. "/album?path=albums"
  855. ) +
  856. `${window.location.hash}`;
  857. window.location.replace(newURL);
  858. } else if (window.location.pathname.startsWith("/artists")) {
  859. window.stop();
  860. let newURL =
  861. `${window.location.protocol}//${selectedInstance}` +
  862. `${window.location.pathname}${window.location.search}`.replace(
  863. "/artists",
  864. "/artist?path=artists"
  865. ) +
  866. `${window.location.hash}`;
  867. window.location.replace(newURL);
  868. }
  869. break;
  870. }
  871. }
  872. }
  873.  
  874. function redirectPinterest() {
  875. if (pinterest[0] == true) {
  876. window.stop();
  877.  
  878. var selectedInstance =
  879. binternetInstances[Math.floor(Math.random() * binternetInstances.length)];
  880.  
  881. if (window.location.hostname == "i.pinimg.com") {
  882. let newURL = `${window.location.protocol}//${selectedInstance}/image_proxy.php?url=${window.location.href}`;
  883. window.location.replace(newURL);
  884. } else if (window.location.pathname.startsWith("/search")) {
  885. let newURL =
  886. `${window.location.protocol}//${selectedInstance}` +
  887. window.location.pathname
  888. .replace("search", "search.php")
  889. .replace("/pins/", "") +
  890. `${window.location.search}${window.location.hash}`;
  891. window.location.replace(newURL);
  892. } else if (window.location.pathname.startsWith("/pin")) {
  893. return;
  894. } else {
  895. let newURL = `${window.location.protocol}//${selectedInstance}/`;
  896. window.location.replace(newURL);
  897. }
  898. }
  899. }
  900.  
  901. function redirectSoundcloud() {
  902. if (soundcloud[0] == true) {
  903. window.stop();
  904. var selectedInstance =
  905. tuboInstances[Math.floor(Math.random() * tuboInstances.length)];
  906.  
  907. if (window.location.pathname != "/") {
  908. let newURL = `${window.location.protocol}//${selectedInstance}/stream?url=${window.location.href}`;
  909. window.location.replace(newURL);
  910. } else {
  911. let newURL = `${window.location.protocol}//${selectedInstance}/kiosk?serviceId=1`;
  912. window.location.replace(newURL);
  913. }
  914. }
  915. }
  916.  
  917. let urlHostname = window.location.hostname;
  918.  
  919. switch (urlHostname) {
  920. case "www.instagram.com":
  921. redirectInstagram();
  922. break;
  923.  
  924. case "twitter.com":
  925. case "mobile.twitter.com":
  926. redirectTwitter();
  927. break;
  928.  
  929. case "www.reddit.com":
  930. case "old.reddit.com":
  931. redirectReddit();
  932. break;
  933.  
  934. case "www.youtube.com":
  935. case "m.youtube.com":
  936. case "www.youtube-nocookie.com":
  937. redirectYoutube();
  938. break;
  939.  
  940. case "www.tiktok.com":
  941. redirectTiktok();
  942. break;
  943.  
  944. case "music.youtube.com":
  945. if (youtubeMusicFrontend == "beatbump") {
  946. redirectYoutubeMusic();
  947. } else {
  948. redirectYoutube();
  949. }
  950. break;
  951.  
  952. case "news.ycombinator.com":
  953. redirectHackerNews();
  954. break;
  955.  
  956. case "translate.google.com":
  957. redirectGTranslate();
  958. break;
  959.  
  960. case "www.reuters.com":
  961. redirectReuters();
  962. break;
  963.  
  964. case "www.imdb.com":
  965. case "m.imdb.com":
  966. redirectImdb();
  967. break;
  968.  
  969. case "www.quora.com":
  970. redirectQuora();
  971. break;
  972.  
  973. case "www.google.com":
  974. redirectGoogle();
  975. break;
  976.  
  977. case "www.goodreads.com":
  978. redirectGoodreads();
  979. break;
  980.  
  981. case "genius.com":
  982. redirectGenius();
  983. break;
  984.  
  985. case "stackoverflow.com":
  986. redirectStackoverflow();
  987. break;
  988.  
  989. case "f4.bcbits.com":
  990. case "t4.bcbits.com":
  991. redirectBandcamp();
  992. break;
  993.  
  994. case "i.pinimg.com":
  995. redirectPinterest();
  996. break;
  997.  
  998. case "soundcloud.com":
  999. redirectSoundcloud();
  1000. break;
  1001.  
  1002. default:
  1003. if (urlHostname.includes("medium.com")) {
  1004. redirectMedium();
  1005. } else if (urlHostname.includes("imgur.com")) {
  1006. redirectImgur();
  1007. } else if (urlHostname.includes("wikipedia.org")) {
  1008. redirectWikipedia();
  1009. } else if (urlHostname.includes("fandom.com")) {
  1010. redirectFandom();
  1011. } else if (urlHostname.includes("bandcamp.com")) {
  1012. redirectBandcamp();
  1013. } else if (urlHostname.includes("pinterest.com")) {
  1014. redirectPinterest();
  1015. }
  1016.  
  1017. break;
  1018. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址