隐私重定向器

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

目前为 2023-11-16 提交的版本。查看 最新版本

  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.5.3
  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 *://*.imgur.io/*
  73. // @match *://*.instagram.com/*
  74. // @match *://*.medium.com/*
  75. // @match *://*.pinterest.com/*
  76. // @match *://i.pinimg.com/*
  77. // @match *://*.quora.com/*
  78. // @match *://*.reddit.com/*
  79. // @match *://*.reuters.com/*
  80. // @match *://*.tiktok.com/*
  81. // @match *://*.twitter.com/*
  82. // @match *://*.wikipedia.org/*
  83. // @match *://*.youtube-nocookie.com/*
  84. // @match *://*.youtube.com/*
  85. // @match *://*.soundcloud.com/*
  86. // @match *://f4.bcbits.com/*
  87. // @match *://genius.com/*
  88. // @match *://imgur.com/*
  89. // @match *://instagram.com/*
  90. // @match *://medium.com/*
  91. // @match *://news.ycombinator.com/*
  92. // @match *://reddit.com/*
  93. // @match *://stackoverflow.com/*
  94. // @match *://t4.bcbits.com/*
  95. // @match *://translate.google.com/*
  96. // @match *://twitter.com/*
  97. // @match *://www.goodreads.com/*
  98. // @match *://youtube.com/*
  99. // @exclude *://*.youtube.com/redirect*
  100. // @exclude *://youtube.com/redirect*
  101. // ==/UserScript==
  102.  
  103. /*
  104. ___ _ _ ___ _____ _____
  105. / _ \| \ | | / _ \| ___| ___|
  106. | | | | \| |_____| | | | |_ | |_
  107. | |_| | |\ |_____| |_| | _| | _|
  108. \___/|_| \_| \___/|_| |_|
  109.  
  110. CHANGE THE RELEVANT VALUE TO "false" TO
  111. DISABLE THE REDIRECTION/FARSIDE FOR THAT
  112. PARTICULAR PLATFORM */
  113.  
  114. // REDIRECTON / FARSIDE
  115.  
  116. let bandcamp = [true, true];
  117. let fandom = [true, true];
  118. let genius = [true, true];
  119. let goodreads = [true, false];
  120. let google = [true, true];
  121. let gtranslate = [true, true];
  122. let hackernews = [true, true];
  123. let imdb = [true, true];
  124. let imgur = [true, false];
  125. let medium = [true, true];
  126. let pinterest = [true, true];
  127. let quora = [true, false];
  128. let reddit = [true, false];
  129. let reuters = [true, true];
  130. let soundcloud = [true, true];
  131. let stackoverflow = [true, true];
  132. let tiktok = [true, false];
  133. let twitter = [true, true];
  134. let wikipedia = [true, false];
  135. let youtube = [true, false];
  136. let instagram = [true, true];
  137.  
  138. // PREFERRED FRONTEND
  139. let youtubeFrontend = "piped"; // accepts "invidious", "piped", "tubo"
  140. let youtubeMusicFrontend = "hyperpipe"; // accepts "hyperpipe", "invidious", "piped"
  141. let redditFrontend = "libreddit"; // accepts "libreddit", "teddit"
  142. let googleFrontend = "librey"; // accepts "librey", "searx", "searxng"
  143. let geniusFrontend = "intellectual"; // accepts dumb, intellectual
  144. let hackernewsFrontend = "better"; // accepts better, worker
  145.  
  146. // OTHER SETTINGS
  147. let keepHistory = false; // keeps farside.link in the browser history
  148.  
  149. // // // // // // // // // // // // //
  150.  
  151. /*
  152. ___ _
  153. |_ _|_ __ ___| |_ __ _ _ __ ___ ___ ___
  154. | || '_ \/ __| __/ _` | '_ \ / __/ _ \/ __|
  155. | || | | \__ \ || (_| | | | | (_| __/\__ \
  156. |___|_| |_|___/\__\__,_|_| |_|\___\___||___/
  157.  
  158. LIST OF INSTANCES TO USE IF FARSIDE IS NOT ENABLED
  159. */
  160.  
  161. const Instances = {
  162. anonymousoverflow: [
  163. "code.whatever.social",
  164. "overflow.smnz.de",
  165. "overflow.lunar.icu",
  166. "overflow.adminforge.de",
  167. "overflow.r4fo.com",
  168. "overflow.hostux.net",
  169. "overflow.projectsegfau.lt",
  170. "ao.bloatcat.tk",
  171. "anonoverflow.frontendfriendly.xyz",
  172. "ao.owo.si",
  173. "overflow.datura.network",
  174. "ao.ftw.lol",
  175. "anonoverflow.hyperreal.coffee",
  176. "overflow.sudovanilla.com",
  177. ],
  178. hyperpipe: [
  179. "hyperpipe.surge.sh",
  180. "hyperpipe.esmailelbob.xyz",
  181. "music.adminforge.de",
  182. "music.pfcd.me",
  183. "hyperpipe.drgns.space",
  184. "hyperpipe.projectsegfau.lt",
  185. "hp.ggtyler.dev",
  186. "hyperpipe.lunar.icu",
  187. ],
  188. proxigram: [
  189. "proxigram.privacyfrontends.repl.co",
  190. "proxigram.protokolla.fi",
  191. "proxigram.kyun.li",
  192. "proxigram.drgns.space",
  193. "ig.opnxng.com",
  194. ],
  195. biblioreads: [
  196. "biblioreads.eu.org",
  197. "biblioreads.vercel.app",
  198. "biblioreads.mooo.com",
  199. "biblioreads.lunar.icu",
  200. "biblioreads.privacyfucking.rocks",
  201. "read.seitan-ayoub.lol",
  202. ],
  203. binternet: [
  204. "binternet.ahwx.org",
  205. "binternet.revvy.de",
  206. "binternet.bloatcat.tk",
  207. "bn.opnxng.com",
  208. "binternet.privacyfucking.rocks",
  209. ],
  210. breezewiki: [
  211. "breezewiki.com",
  212. "antifandom.com",
  213. "breezewiki.pussthecat.org",
  214. "bw.hamstro.dev",
  215. "bw.projectsegfau.lt",
  216. "breeze.hostux.net",
  217. "bw.artemislena.eu",
  218. "nerd.whatever.social",
  219. "breezewiki.frontendfriendly.xyz",
  220. "breeze.nohost.network",
  221. "z.opnxng.com",
  222. "breezewiki.hyperreal.coffee",
  223. "breezewiki.catsarch.com",
  224. "breeze.mint.lgbt",
  225. "breezewiki.woodland.cafe",
  226. ],
  227. dumb: ["sing.whatever.social", "dumb.lunar.icu", "dumb.privacydev.net"],
  228. intellectual: [
  229. "intellectual.insprill.net",
  230. "in.bloatcat.tk",
  231. "intellectual.privacyfucking.rocks",
  232. ],
  233. invidious: [
  234. "yewtu.be",
  235. "vid.puffyan.us",
  236. "yt.artemislena.eu",
  237. "invidious.flokinet.to",
  238. "invidious.projectsegfau.lt",
  239. "invidious.slipfox.xyz",
  240. "invidious.privacydev.net",
  241. "vid.priv.au",
  242. "iv.ggtyler.dev",
  243. "invidious.lunar.icu",
  244. "inv.zzls.xyz",
  245. "inv.tux.pizza",
  246. "invidious.protokolla.fi",
  247. "proxied.invidious.fi",
  248. "onion.tube",
  249. "inv.citw.lgbt",
  250. "yt.oelrichsgarcia.de",
  251. "invidious.no-logs.com",
  252. "invidious.io.lol",
  253. "iv.nboeck.de",
  254. "invidious.private.coffee",
  255. "invidious.asir.dev",
  256. "iv.datura.network",
  257. "invidious.fdn.fr",
  258. "anontube.lvkaszus.pl",
  259. "invidious.perennialte.ch",
  260. "yt.cdaut.de",
  261. "invidious.drgns.space",
  262. "invidious.einfachzocken.eu",
  263. ],
  264. piped: [
  265. "piped.video",
  266. "cf.piped.video",
  267. "fl.piped.video",
  268. "do.piped.video",
  269. "piped.syncpundit.io",
  270. "piped.mha.fi",
  271. "watch.leptons.xyz",
  272. "piped.lunar.icu",
  273. "piped.r4fo.com",
  274. "piped.game.yt",
  275. "il.ax",
  276. "piped.projectsegfau.lt",
  277. "watch.whatever.social",
  278. "piped.privacydev.net",
  279. "piped.smnz.de",
  280. "piped.adminforge.de",
  281. "piped.hostux.net",
  282. "piped.yt",
  283. "piped.astartes.nl",
  284. "piped.osphost.fi",
  285. "piped.drgns.space",
  286. "pi.ggtyler.dev",
  287. "piped.seitan-ayoub.lol",
  288. "piped.12a.app",
  289. ],
  290. libreddit: [
  291. "redditor.fly.dev",
  292. "libreddit.kavin.rocks",
  293. "libreddit.strongthany.cc",
  294. "libreddit.northboot.xyz",
  295. "libreddit.hu",
  296. "libreddit.kylrth.com",
  297. "libreddit.tiekoetter.com",
  298. "l.opnxng.com",
  299. "libreddit.projectsegfau.lt",
  300. "libreddit.privacydev.net",
  301. "discuss.whatever.social",
  302. "libreddit.frontendfriendly.xyz",
  303. "libreddit.oxymagnesium.com",
  304. "libreddit.freedit.eu",
  305. "libreddit.mha.fi",
  306. "lr.artemislena.eu",
  307. "libreddit.nohost.network",
  308. "lr.aeong.one",
  309. "libreddit.lunar.icu",
  310. "libreddit.r4fo.com",
  311. "snoo.habedieeh.re",
  312. "libreddit.kutay.dev",
  313. "libreddit.tux.pizza",
  314. "libreddit.nerdyfam.tech",
  315. "libreddit.perennialte.ch",
  316. "libreddit.baczek.me",
  317. ],
  318. libremdb: [
  319. "libremdb.iket.me",
  320. "libremdb.pussthecat.org",
  321. "binge.whatever.social",
  322. "libremdb.lunar.icu",
  323. "libremdb.jeikobu.net",
  324. "libremdb.nerdyfam.tech",
  325. "libremdb.tux.pizza",
  326. "libremdb.frontendfriendly.xyz",
  327. "d.opnxng.com",
  328. "libremdb.catsarch.com",
  329. ],
  330. librey: [
  331. "search.ahwx.org",
  332. "search2.ahwx.org",
  333. "librex.zzls.xyz",
  334. "ly.owo.si",
  335. "librey.org",
  336. "librex.supernets.org",
  337. "search.davidovski.xyz",
  338. "librey.bloatcat.tk",
  339. "search.funami.tech",
  340. "librex.retro-hax.net",
  341. "librex.nohost.network",
  342. "search.pabloferreiro.es",
  343. "librex.yogeshlamichhane.com.np",
  344. "librey.baczek.me",
  345. "lx.benike.me",
  346. "search.seitan-ayoub.lol",
  347. ],
  348. lingva: [
  349. "lingva.ml",
  350. "lingva.frontendfriendly.xyz",
  351. "lingva.retiolus.net",
  352. "translate.plausibility.cloud",
  353. "lingva.lunar.icu",
  354. "lingva.garudalinux.org",
  355. ],
  356. nitter: [
  357. "nitter.net",
  358. "nitter:nitter@nitter.nixnet.services",
  359. "nitter.unixfox.eu",
  360. "nitter.mint.lgbt",
  361. "nitter.esmailelbob.xyz",
  362. "nitter.poast.org",
  363. "nitter.cz",
  364. "nitter.projectsegfau.lt",
  365. "nitter.soopy.moe",
  366. "nitter.rawbit.ninja",
  367. "nitter.d420.de",
  368. "nitter.nohost.network",
  369. "nitter.x86-64-unknown-linux-gnu.zip",
  370. "nitter.woodland.cafe",
  371. "nitter.dafriser.be",
  372. "nitter.perennialte.ch",
  373. "nitter.salastil.com",
  374. "n.populas.no",
  375. "nitter.uni-sonia.com",
  376. "n.opnxng.com",
  377. "nitter.ktachibana.party",
  378. ],
  379. proxitok: [
  380. "proxitok.pabloferreiro.es",
  381. "proxitok.pussthecat.org",
  382. "tok.habedieeh.re",
  383. "proxitok.privacydev.net",
  384. "tok.artemislena.eu",
  385. "tok.adminforge.de",
  386. "tik.hostux.net",
  387. "cringe.whatever.social",
  388. "proxitok.lunar.icu",
  389. "proxitok.r4fo.com",
  390. "cringe.datura.network",
  391. "tt.opnxng.com",
  392. "proxitok.tinfoil-hat.net",
  393. "tiktok.wpme.pl",
  394. ],
  395. quetre: [
  396. "quetre.iket.me",
  397. "quetre.pussthecat.org",
  398. "quetre.privacydev.net",
  399. "ask.habedieeh.re",
  400. "quetre.blackdrgn.nl",
  401. "quetre.lunar.icu",
  402. "quetre.frontendfriendly.xyz",
  403. "q.opnxng.com",
  404. "quetre.ftw.lol",
  405. "quora.seitan-ayoub.lol",
  406. "quetre.catsarch.com",
  407. "quetre.drgns.space",
  408. ],
  409. rimgo: [
  410. "rimgo.totaldarkness.net",
  411. "imgur.artemislena.eu",
  412. "ri.zzls.xyz",
  413. "rimgo.lunar.icu",
  414. "rimgo.kling.gg",
  415. "rimgo.projectsegfau.lt",
  416. "rimgo.nohost.network",
  417. "rimgo.catsarch.com",
  418. "rimgo.drgns.space",
  419. "rimgo.quantenzitrone.eu",
  420. "rimgo.frylo.net",
  421. ],
  422. scribe: [
  423. "scribe.rip",
  424. "scribe.citizen4.eu",
  425. "scribe.rawbit.ninja",
  426. "m.opnxng.com",
  427. ],
  428. teddit: [
  429. "i.opnxng.com",
  430. "teddit.bus-hit.me",
  431. "teddit.hostux.net",
  432. "teddit.net",
  433. "teddit.rawbit.ninja",
  434. "teddit.projectsegfau.lt",
  435. "teddit.pussthecat.org",
  436. "teddit.zaggy.nl",
  437. "t.sneed.network",
  438. ],
  439. tent: ["tent.sny.sh", "tent.bloatcat.tk"],
  440. tubo: ["tubo.migalmoreno.com"],
  441. wikiless: [
  442. "wikiless.tiekoetter.com",
  443. "wikiless.funami.tech",
  444. "wikiless.rawbit.ninja",
  445. "wiki.adminforge.de",
  446. "wikiless.r4fo.com",
  447. "wiki.seitan-ayoub.lol",
  448. "wikiless.ftw.lol",
  449. "wl.ftw.lol",
  450. "w.sneed.network",
  451. "wikiless.ditatompel.com",
  452. ],
  453. searx: [
  454. "search.bus-hit.me",
  455. "search.projectsegfau.lt",
  456. "northboot.xyz",
  457. "opnxng.com",
  458. ],
  459. searxng: [
  460. "search.sapti.me",
  461. "priv.au",
  462. "search.demoniak.ch",
  463. "www.gruble.de",
  464. "search.lvkaszus.pl",
  465. "searx.divided-by-zero.eu",
  466. "xo.wtf",
  467. "freesearch.club",
  468. "search.ovh",
  469. "baresearch.org",
  470. "searx.perennialte.ch",
  471. "searx.techsaviours.org",
  472. "search.mdosch.de",
  473. "searx.kutay.dev",
  474. "searx.si",
  475. "searx.namejeff.xyz",
  476. "search.whateveritworks.org",
  477. "search.ononoki.org",
  478. "etsi.me",
  479. "searx.work",
  480. "search.smnz.de",
  481. "searx.prvcy.eu",
  482. "searx.headpat.exchange",
  483. ],
  484. hackernews: {
  485. better: "better-hackernews.vercel.app",
  486. worker: "news.workers.tools",
  487. },
  488. };
  489.  
  490. let farsideInstance = keepHistory ? "farside.link/_" : "farside.link";
  491.  
  492. // // // // // // // // // // // // //
  493.  
  494. const hash = window.location.hash,
  495. scheme = `${window.location.protocol}//`;
  496.  
  497. let debug_mode = false;
  498.  
  499. if (debug_mode) {
  500. alert(
  501. "\n== DEBUG MODE IS ON ==" +
  502. "\nIf you're seeing this" +
  503. "\nset the debug_mode value to" +
  504. "\nfalse for Privacy Redirector." +
  505. "\n======================" +
  506. "\n\nHostname: " +
  507. window.location.hostname +
  508. "\nPath: " +
  509. window.location.pathname +
  510. "\nQuery: " +
  511. window.location.search +
  512. "\nHash: " +
  513. hash
  514. );
  515. }
  516.  
  517. let selectedInstance = "",
  518. newURL = "";
  519.  
  520. const getrandom = async (instances) =>
  521. instances[Math.floor(Math.random() * instances.length)];
  522.  
  523. async function redirectInstagram() {
  524. if (instagram[0]) {
  525. window.stop();
  526. let pathname = window.location.pathname;
  527. let search = window.location.search;
  528. let params = new URLSearchParams(search);
  529.  
  530. selectedInstance = await getrandom(Instances.proxigram);
  531.  
  532. switch (true) {
  533. case pathname.startsWith("/accounts/login/"):
  534. case pathname.startsWith("/accounts/signup/"):
  535. pathname = pathname.replace(/^\/accounts\/(login|signup)\/[a-z]*/, "");
  536. params.delete("next");
  537. search = params.size ? `?${params}` : "";
  538. break;
  539. case pathname.startsWith("/reel/"):
  540. case pathname.startsWith("/tv/"):
  541. pathname = pathname.replace(/^\/(reel|tv)\//, "/p/");
  542. break;
  543. case pathname.endsWith("/reels/"):
  544. pathname = pathname.replace("/reels", "");
  545. break;
  546. }
  547. newURL = `${scheme}${selectedInstance}${pathname}${search}${hash}`;
  548. window.location.replace(newURL);
  549. }
  550. }
  551.  
  552. async function redirectTwitter() {
  553. if (twitter[0]) {
  554. window.stop();
  555.  
  556. let path = window.location.pathname;
  557. let search = window.location.search;
  558.  
  559. selectedInstance = twitter[1]
  560. ? `${farsideInstance}/nitter`
  561. : await getrandom(Instances.nitter);
  562.  
  563. if (path.startsWith("/i/flow/login")) {
  564. path = path.replace("/i/flow/login", "");
  565. search = search.replace("?redirect_after_login=%2F", "/");
  566. }
  567.  
  568. path.includes("%2F") && (path = path.replace("%2F", "/"));
  569. search.includes("%2F") && (search = search.replace("%2F", "/"));
  570.  
  571. newURL = `${scheme}${selectedInstance}${path}${search}${hash}`;
  572. window.location.replace(newURL);
  573. }
  574. }
  575.  
  576. async function redirectReddit() {
  577. if (reddit[0] && !window.location.pathname.startsWith("/domain")) {
  578. window.stop();
  579. let pathname = window.location.pathname;
  580. let search = window.location.search;
  581.  
  582. selectedInstance = reddit[1]
  583. ? `${farsideInstance}/${redditFrontend}`
  584. : await getrandom(Instances[redditFrontend]);
  585.  
  586. if (pathname === "/media" && search) {
  587. const params = new URLSearchParams(search);
  588. const mediaURL = new URL(params.get("url"));
  589. if (["i.redd.it", "preview.redd.it"].includes(mediaURL.hostname)) {
  590. pathname = `/img${mediaURL.pathname}`;
  591. search = mediaURL.search;
  592. }
  593. }
  594. newURL = `${scheme}${selectedInstance}${pathname}${search}${hash}`;
  595.  
  596. window.location.replace(newURL);
  597. }
  598. }
  599.  
  600. async function redirectYoutube(frontend) {
  601. if (youtube[0]) {
  602. window.stop();
  603. if (frontend !== "tubo") {
  604. selectedInstance =
  605. youtube[1] && frontend !== "hyperpipe"
  606. ? `${farsideInstance}/${frontend}`
  607. : await getrandom(Instances[frontend]);
  608.  
  609. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  610. } else {
  611. selectedInstance = await getrandom(Instances.tubo);
  612.  
  613. newURL = `${scheme}${selectedInstance}/stream?url=${window.location.href}`;
  614. if (
  615. window.location.pathname.startsWith("/@") ||
  616. window.location.pathname.startsWith("/channel")
  617. ) {
  618. newURL = `${scheme}${selectedInstance}/channel?url=${window.location.href}`;
  619. }
  620. }
  621. window.location.replace(newURL);
  622. }
  623. }
  624.  
  625. async function redirectTiktok() {
  626. if (tiktok[0]) {
  627. window.stop();
  628. let pathname = window.location.pathname;
  629. selectedInstance = tiktok[1]
  630. ? `${farsideInstance}/proxitok`
  631. : await getrandom(Instances.proxitok);
  632.  
  633. if (pathname.startsWith("/foryou")) {
  634. pathname = pathname.replace("/foryou", "/trending");
  635. } else if (pathname.startsWith("/discover/")) {
  636. pathname = pathname.replace("discover", "tag");
  637. }
  638. newURL = `${scheme}${selectedInstance}${pathname}${window.location.search}${hash}`;
  639. window.location.replace(newURL);
  640. }
  641. }
  642.  
  643. async function redirectImgur() {
  644. if (imgur[0]) {
  645. window.stop();
  646.  
  647. selectedInstance = imgur[1]
  648. ? `${farsideInstance}/rimgo`
  649. : await getrandom(Instances.rimgo);
  650.  
  651. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  652.  
  653. window.location.replace(newURL);
  654. }
  655. }
  656.  
  657. async function redirectMedium() {
  658. if (medium[0]) {
  659. const host_path = `${window.location.hostname}${window.location.pathname}`;
  660.  
  661. if (
  662. (/^.+?\.medium\.com\/.+/.test(host_path) ||
  663. /^\/@?[a-z0-9\-\_]+\//.test(window.location.pathname) ||
  664. host_path === "medium.com/") &&
  665. !(
  666. /^\/(tag|m|hc)\//.test(window.location.pathname) ||
  667. /\/(about|followers|following)/.test(window.location.pathname)
  668. )
  669. ) {
  670. window.stop();
  671. selectedInstance = medium[1]
  672. ? `${farsideInstance}/scribe`
  673. : await getrandom(Instances.scribe);
  674. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  675. window.location.replace(newURL);
  676. }
  677. }
  678. }
  679.  
  680. async function redirectHackerNews() {
  681. if (hackernews[0]) {
  682. let pathname = window.location.pathname;
  683. if (
  684. ["/newest", "/item", "/user", "/ask", "/show", "/jobs", "/"].includes(
  685. pathname
  686. )
  687. ) {
  688. if (
  689. hackernewsFrontend === "better" &&
  690. window.location.pathname === "/newest"
  691. ) {
  692. pathname = "/new";
  693. }
  694. selectedInstance = Instances.hackernews[hackernewsFrontend];
  695. } else if (
  696. ["/best", "/news", "/submitted", "/threads", "/classic"].includes(
  697. pathname
  698. )
  699. ) {
  700. selectedInstance = Instances.hackernews.worker;
  701. }
  702. if (selectedInstance) {
  703. window.stop();
  704. newURL = `${scheme}${selectedInstance}${pathname}${window.location.search}`;
  705. window.location.replace(newURL);
  706. }
  707. }
  708. }
  709.  
  710. async function redirectGTranslate() {
  711. if (gtranslate[0]) {
  712. window.stop();
  713.  
  714. selectedInstance = gtranslate[1]
  715. ? `${farsideInstance}/lingva`
  716. : await getrandom(Instances.lingva);
  717.  
  718. newURL = `${scheme}${selectedInstance}`;
  719. if (window.location.search) {
  720. const params = new URLSearchParams(window.location.search);
  721. newURL += `/${params.get("sl")}/${params.get("tl")}/${params.get(
  722. "text"
  723. )}`;
  724. } else if (/^\/\w+\/\w+\/.*/.test(window.location.pathname)) {
  725. newURL += window.location.pathname.replace(/\+/g, " ");
  726. }
  727. window.location.replace(newURL);
  728. }
  729. }
  730.  
  731. async function redirectReuters() {
  732. if (reuters[0]) {
  733. window.stop();
  734. location.hostname = "neuters.de";
  735. }
  736. }
  737.  
  738. async function redirectWikipedia() {
  739. if (wikipedia[0]) {
  740. window.stop();
  741. let langCode = /^([a-z\-]+)\./.exec(window.location.hostname)[1];
  742.  
  743. selectedInstance = wikipedia[1]
  744. ? `${farsideInstance}/wikiless`
  745. : await getrandom(Instances.wikiless);
  746.  
  747. if (langCode === "www") langCode = "en";
  748. newURL = `${scheme}${selectedInstance}${window.location.pathname}?lang=${langCode}${hash}`;
  749. window.location.replace(newURL);
  750. }
  751. }
  752.  
  753. async function redirectImdb() {
  754. if (imdb[0]) {
  755. window.stop();
  756.  
  757. selectedInstance = imdb[1]
  758. ? `${farsideInstance}/libremdb`
  759. : await getrandom(Instances.libremdb);
  760.  
  761. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  762.  
  763. window.location.replace(newURL);
  764. }
  765. }
  766.  
  767. async function redirectQuora() {
  768. if (quora[0]) {
  769. window.stop();
  770.  
  771. selectedInstance = quora[1]
  772. ? `${farsideInstance}/quetre`
  773. : await getrandom(Instances.quetre);
  774.  
  775. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  776.  
  777. window.location.replace(newURL);
  778. }
  779. }
  780.  
  781. async function redirectFandom() {
  782. if (fandom[0]) {
  783. selectedInstance = await getrandom(Instances.breezewiki);
  784. const fandomName = window.location.hostname.replace(/\..+/, "");
  785. window.stop();
  786.  
  787. newURL = `${scheme}${selectedInstance}`;
  788. if (fandomName !== "www") {
  789. newURL += `/${fandomName}${window.location.pathname}${window.location.search}${hash}`;
  790. }
  791.  
  792. window.location.replace(newURL);
  793. }
  794. }
  795.  
  796. async function redirectGoogle() {
  797. if (
  798. google[0] &&
  799. window.location.hostname.startsWith("www") &&
  800. window.location.pathname.startsWith("/search")
  801. ) {
  802. window.stop();
  803.  
  804. selectedInstance = google[1]
  805. ? `${farsideInstance}/${googleFrontend}`
  806. : (selectedInstance = await getrandom(Instances[googleFrontend]));
  807.  
  808. let pathname = window.location.pathname;
  809. if (googleFrontend === "librey" && pathname === "/search")
  810. pathname += ".php";
  811. const params = new URLSearchParams(window.location.search);
  812. const query = params.entries().q;
  813. const search = query ? `?q=${query}` : window.location.search;
  814. newURL = `${scheme}${selectedInstance}${pathname}${search}${hash}`;
  815. window.location.replace(newURL);
  816. }
  817. }
  818.  
  819. async function redirectGoodreads() {
  820. if (goodreads[0]) {
  821. window.stop();
  822.  
  823. selectedInstance = await getrandom(Instances.biblioreads);
  824.  
  825. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  826. if (window.location.pathname.startsWith("/search")) {
  827. const params = new URLSearchParams(window.location.search);
  828. newURL = `${scheme}${selectedInstance}${
  829. window.location.pathname
  830. }/${params.get("q")}${hash}`;
  831. }
  832. window.location.replace(newURL);
  833. }
  834. }
  835.  
  836. async function redirectStackoverflow() {
  837. if (
  838. stackoverflow[0] &&
  839. (window.location.pathname.startsWith("/questions/") ||
  840. window.location.pathname === "/")
  841. ) {
  842. window.stop();
  843. selectedInstance = stackoverflow[1]
  844. ? `${farsideInstance}/anonymousoverflow`
  845. : await getrandom(Instances.anonymousoverflow);
  846.  
  847. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  848. window.location.replace(newURL);
  849. }
  850. }
  851.  
  852. async function redirectBandcamp() {
  853. if (bandcamp[0]) {
  854. // thanks to libredirect
  855.  
  856. selectedInstance = await getrandom(Instances.tent);
  857. const params = new URLSearchParams(window.location.search);
  858.  
  859. if (
  860. `${window.location.hostname}${window.location.pathname}` ===
  861. "bandcamp.com/search"
  862. ) {
  863. newURL = `${scheme}${selectedInstance}/search.php?query=${params.get(
  864. "q"
  865. )}`;
  866. }
  867.  
  868. if (window.location.hostname.search(/(daily)?\.bandcamp\.com/) > 0) {
  869. const artist = window.location.hostname.replace(/\..+/, "");
  870. if (window.location.pathname === "/") {
  871. newURL = `${scheme}${selectedInstance}/artist.php?name=${artist}`;
  872. } else {
  873. const regex = /^\/(.+?)\/(.+)/.exec(window.location.pathname);
  874. if (regex) {
  875. const type = regex[1];
  876. const name = regex[2];
  877. newURL = `${scheme}${selectedInstance}/release.php?artist=${artist}&type=${type}&name=${name}`;
  878. }
  879. }
  880. }
  881.  
  882. if (window.location.hostname === "f4.bcbits.com") {
  883. const image = /^\/img\/(.+)/.exec(window.location.pathname)[1];
  884. newURL = `${scheme}${selectedInstance}/image.php?file=${image}`;
  885. }
  886.  
  887. if (window.location.hostname === "t4.bcbits.com") {
  888. const regex = /^\/stream\/([a-f0-9]+)\/(.+)\/([0-9]+)/.exec(
  889. window.location.pathname
  890. );
  891. if (regex) {
  892. const directory = regex[1];
  893. const format = regex[2];
  894. const file = regex[3];
  895. const token = params.get("token");
  896. newURL = `${scheme}${selectedInstance}/audio.php?directory=${directory}&format=${format}&file=${file}&token=${token}`;
  897. }
  898. }
  899.  
  900. if (newURL) window[(stop(), location.replace(newURL))];
  901. }
  902. }
  903.  
  904. async function redirectGenius() {
  905. if (genius[0]) {
  906. const searchpath = `${window.location.pathname}${window.location.search}`;
  907.  
  908. selectedInstance = await getrandom(Instances[geniusFrontend]);
  909. switch (geniusFrontend) {
  910. case "dumb":
  911. newURL = `${scheme}${selectedInstance}${searchpath}${hash}`;
  912. break;
  913. case "intellectual":
  914. if (window.location.pathname.endsWith("-lyrics")) {
  915. newURL = `${scheme}${selectedInstance}/lyrics?path=${searchpath.slice(
  916. 1
  917. )}${hash}`;
  918. } else if (window.location.pathname.startsWith("/albums/")) {
  919. newURL = `${scheme}${selectedInstance}${searchpath.replace(
  920. "/albums",
  921. "/album?path=albums"
  922. )}${hash}`;
  923. } else if (window.location.pathname.startsWith("/artists/")) {
  924. newURL = `${scheme}${selectedInstance}${searchpath.replace(
  925. "/artists",
  926. "/artist?path=artists"
  927. )}${hash}`;
  928. }
  929. break;
  930. }
  931.  
  932. if (newURL) window[(stop(), location.replace(newURL))];
  933. }
  934. }
  935.  
  936. async function redirectPinterest() {
  937. if (pinterest[0]) {
  938. selectedInstance = await getrandom(Instances.binternet);
  939.  
  940. if (window.location.hostname === "i.pinimg.com") {
  941. newURL = `${scheme}${selectedInstance}/image_proxy.php?url=${window.location.href}`;
  942. } else if (window.location.pathname.startsWith("/search")) {
  943. newURL = `${scheme}${selectedInstance}${window.location.pathname
  944. .replace("search", "search.php")
  945. .replace("/pins/", "")}${window.location.search}${hash}`;
  946. } else if (window.location.pathname === "/") {
  947. newURL = `${scheme}${selectedInstance}`;
  948. }
  949.  
  950. if (newURL) window[(stop(), location.replace(newURL))];
  951. }
  952. }
  953.  
  954. async function redirectSoundcloud() {
  955. if (soundcloud[0]) {
  956. window.stop();
  957. selectedInstance = await getrandom(Instances.tubo);
  958.  
  959. newURL = `${scheme}${selectedInstance}/kiosk?serviceId=1`;
  960. if (window.location.pathname !== "/") {
  961. newURL = `${scheme}${selectedInstance}/stream?url=${window.location.href}`;
  962. }
  963. window.location.replace(newURL);
  964. }
  965. }
  966.  
  967. const urlHostname = window.location.hostname;
  968.  
  969. switch (urlHostname) {
  970. case "www.instagram.com":
  971. redirectInstagram();
  972. break;
  973.  
  974. case "twitter.com":
  975. case "mobile.twitter.com":
  976. redirectTwitter();
  977. break;
  978.  
  979. case "www.youtube.com":
  980. case "m.youtube.com":
  981. case "www.youtube-nocookie.com":
  982. redirectYoutube(youtubeFrontend);
  983. break;
  984.  
  985. case "www.tiktok.com":
  986. redirectTiktok();
  987. break;
  988.  
  989. case "music.youtube.com":
  990. redirectYoutube(youtubeMusicFrontend);
  991. break;
  992.  
  993. case "news.ycombinator.com":
  994. redirectHackerNews();
  995. break;
  996.  
  997. case "translate.google.com":
  998. redirectGTranslate();
  999. break;
  1000.  
  1001. case "www.reuters.com":
  1002. redirectReuters();
  1003. break;
  1004.  
  1005. case "www.imdb.com":
  1006. case "m.imdb.com":
  1007. redirectImdb();
  1008. break;
  1009.  
  1010. case "www.quora.com":
  1011. redirectQuora();
  1012. break;
  1013.  
  1014. case "www.google.com":
  1015. redirectGoogle();
  1016. break;
  1017.  
  1018. case "www.goodreads.com":
  1019. redirectGoodreads();
  1020. break;
  1021.  
  1022. case "genius.com":
  1023. redirectGenius();
  1024. break;
  1025.  
  1026. case "stackoverflow.com":
  1027. redirectStackoverflow();
  1028. break;
  1029.  
  1030. case "f4.bcbits.com":
  1031. case "t4.bcbits.com":
  1032. redirectBandcamp();
  1033. break;
  1034.  
  1035. case "i.pinimg.com":
  1036. redirectPinterest();
  1037. break;
  1038.  
  1039. case "soundcloud.com":
  1040. case "m.soundcloud.com":
  1041. redirectSoundcloud();
  1042. break;
  1043.  
  1044. case urlHostname.includes("reddit.com") ? urlHostname : 0:
  1045. redirectReddit();
  1046. break;
  1047.  
  1048. case urlHostname.includes("medium.com") ? urlHostname : 0:
  1049. redirectMedium();
  1050. break;
  1051.  
  1052. case urlHostname.includes("imgur.com") ? urlHostname : 0:
  1053. case urlHostname.includes("imgur.io") ? urlHostname : 0:
  1054. redirectImgur();
  1055. break;
  1056.  
  1057. case urlHostname.includes("wikipedia.org") ? urlHostname : 0:
  1058. redirectWikipedia();
  1059. break;
  1060.  
  1061. case urlHostname.includes("fandom.com") ? urlHostname : 0:
  1062. redirectFandom();
  1063. break;
  1064.  
  1065. case urlHostname.includes("bandcamp.com") ? urlHostname : 0:
  1066. redirectBandcamp();
  1067. break;
  1068.  
  1069. case urlHostname.includes("pinterest.com") ? urlHostname : 0:
  1070. redirectPinterest();
  1071. break;
  1072. }

QingJ © 2025

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