隐私重定向器

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

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

  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.2
  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.  
  570. newURL = `${scheme}${selectedInstance}${path}${search}${hash}`;
  571. window.location.replace(newURL);
  572. }
  573. }
  574.  
  575. async function redirectReddit() {
  576. if (reddit[0] && !window.location.pathname.startsWith("/domain")) {
  577. window.stop();
  578. let pathname = window.location.pathname;
  579. let search = window.location.search;
  580.  
  581. selectedInstance = reddit[1]
  582. ? `${farsideInstance}/${redditFrontend}`
  583. : await getrandom(Instances[redditFrontend]);
  584.  
  585. if (pathname === "/media" && search) {
  586. const params = new URLSearchParams(search);
  587. const mediaURL = new URL(params.get("url"));
  588. if (["i.redd.it", "preview.redd.it"].includes(mediaURL.hostname)) {
  589. pathname = `/img${mediaURL.pathname}`;
  590. search = mediaURL.search;
  591. }
  592. }
  593. newURL = `${scheme}${selectedInstance}${pathname}${search}${hash}`;
  594.  
  595. window.location.replace(newURL);
  596. }
  597. }
  598.  
  599. async function redirectYoutube(frontend) {
  600. if (youtube[0]) {
  601. window.stop();
  602. if (frontend !== "tubo") {
  603. selectedInstance =
  604. youtube[1] && frontend !== "hyperpipe"
  605. ? `${farsideInstance}/${frontend}`
  606. : await getrandom(Instances[frontend]);
  607.  
  608. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  609. } else {
  610. selectedInstance = await getrandom(Instances.tubo);
  611.  
  612. newURL = `${scheme}${selectedInstance}/stream?url=${window.location.href}`;
  613. if (
  614. window.location.pathname.startsWith("/@") ||
  615. window.location.pathname.startsWith("/channel")
  616. ) {
  617. newURL = `${scheme}${selectedInstance}/channel?url=${window.location.href}`;
  618. }
  619. }
  620. window.location.replace(newURL);
  621. }
  622. }
  623.  
  624. async function redirectTiktok() {
  625. if (tiktok[0]) {
  626. window.stop();
  627. let pathname = window.location.pathname;
  628. selectedInstance = tiktok[1]
  629. ? `${farsideInstance}/proxitok`
  630. : await getrandom(Instances.proxitok);
  631.  
  632. if (pathname.startsWith("/foryou")) {
  633. pathname = pathname.replace("/foryou", "/trending");
  634. } else if (pathname.startsWith("/discover/")) {
  635. pathname = pathname.replace("discover", "tag");
  636. }
  637. newURL = `${scheme}${selectedInstance}${pathname}${window.location.search}${hash}`;
  638. window.location.replace(newURL);
  639. }
  640. }
  641.  
  642. async function redirectImgur() {
  643. if (imgur[0]) {
  644. window.stop();
  645.  
  646. selectedInstance = imgur[1]
  647. ? `${farsideInstance}/rimgo`
  648. : await getrandom(Instances.rimgo);
  649.  
  650. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  651.  
  652. window.location.replace(newURL);
  653. }
  654. }
  655.  
  656. async function redirectMedium() {
  657. if (medium[0]) {
  658. const host_path = `${window.location.hostname}${window.location.pathname}`;
  659.  
  660. if (
  661. (/^.+?\.medium\.com\/.+/.test(host_path) ||
  662. /^\/@?[a-z0-9\-\_]+\//.test(window.location.pathname) ||
  663. host_path === "medium.com/") &&
  664. !(
  665. /^\/(tag|m|hc)\//.test(window.location.pathname) ||
  666. /\/(about|followers|following)/.test(window.location.pathname)
  667. )
  668. ) {
  669. window.stop();
  670. selectedInstance = medium[1]
  671. ? `${farsideInstance}/scribe`
  672. : await getrandom(Instances.scribe);
  673. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  674. window.location.replace(newURL);
  675. }
  676. }
  677. }
  678.  
  679. async function redirectHackerNews() {
  680. if (hackernews[0]) {
  681. let pathname = window.location.pathname;
  682. if (
  683. ["/newest", "/item", "/user", "/ask", "/show", "/jobs", "/"].includes(
  684. pathname
  685. )
  686. ) {
  687. if (
  688. hackernewsFrontend === "better" &&
  689. window.location.pathname === "/newest"
  690. ) {
  691. pathname = "/new";
  692. }
  693. selectedInstance = Instances.hackernews[hackernewsFrontend];
  694. } else if (
  695. ["/best", "/news", "/submitted", "/threads", "/classic"].includes(
  696. pathname
  697. )
  698. ) {
  699. selectedInstance = Instances.hackernews.worker;
  700. }
  701. if (selectedInstance) {
  702. window.stop();
  703. newURL = `${scheme}${selectedInstance}${pathname}${window.location.search}`;
  704. window.location.replace(newURL);
  705. }
  706. }
  707. }
  708.  
  709. async function redirectGTranslate() {
  710. if (gtranslate[0]) {
  711. window.stop();
  712.  
  713. selectedInstance = gtranslate[1]
  714. ? `${farsideInstance}/lingva`
  715. : await getrandom(Instances.lingva);
  716.  
  717. newURL = `${scheme}${selectedInstance}`;
  718. if (window.location.search) {
  719. const params = new URLSearchParams(window.location.search);
  720. newURL += `/${params.get("sl")}/${params.get("tl")}/${params.get(
  721. "text"
  722. )}`;
  723. } else if (/^\/\w+\/\w+\/.*/.test(window.location.pathname)) {
  724. newURL += window.location.pathname.replace(/\+/g, " ");
  725. }
  726. window.location.replace(newURL);
  727. }
  728. }
  729.  
  730. async function redirectReuters() {
  731. if (reuters[0]) {
  732. window.stop();
  733. location.hostname = "neuters.de";
  734. }
  735. }
  736.  
  737. async function redirectWikipedia() {
  738. if (wikipedia[0]) {
  739. window.stop();
  740. let langCode = /^([a-z\-]+)\./.exec(window.location.hostname)[1];
  741.  
  742. selectedInstance = wikipedia[1]
  743. ? `${farsideInstance}/wikiless`
  744. : await getrandom(Instances.wikiless);
  745.  
  746. if (langCode === "www") langCode = "en";
  747. newURL = `${scheme}${selectedInstance}${window.location.pathname}?lang=${langCode}${hash}`;
  748. window.location.replace(newURL);
  749. }
  750. }
  751.  
  752. async function redirectImdb() {
  753. if (imdb[0]) {
  754. window.stop();
  755.  
  756. selectedInstance = imdb[1]
  757. ? `${farsideInstance}/libremdb`
  758. : await getrandom(Instances.libremdb);
  759.  
  760. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  761.  
  762. window.location.replace(newURL);
  763. }
  764. }
  765.  
  766. async function redirectQuora() {
  767. if (quora[0]) {
  768. window.stop();
  769.  
  770. selectedInstance = quora[1]
  771. ? `${farsideInstance}/quetre`
  772. : await getrandom(Instances.quetre);
  773.  
  774. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  775.  
  776. window.location.replace(newURL);
  777. }
  778. }
  779.  
  780. async function redirectFandom() {
  781. if (fandom[0]) {
  782. selectedInstance = await getrandom(Instances.breezewiki);
  783. const fandomName = window.location.hostname.replace(/\..+/, "");
  784. window.stop();
  785.  
  786. newURL = `${scheme}${selectedInstance}`;
  787. if (fandomName !== "www") {
  788. newURL += `/${fandomName}${window.location.pathname}${window.location.search}${hash}`;
  789. }
  790.  
  791. window.location.replace(newURL);
  792. }
  793. }
  794.  
  795. async function redirectGoogle() {
  796. if (
  797. google[0] &&
  798. window.location.hostname.startsWith("www") &&
  799. window.location.pathname.startsWith("/search")
  800. ) {
  801. window.stop();
  802.  
  803. selectedInstance = google[1]
  804. ? `${farsideInstance}/${googleFrontend}`
  805. : (selectedInstance = await getrandom(Instances[googleFrontend]));
  806.  
  807. let pathname = window.location.pathname;
  808. if (googleFrontend === "librey" && pathname === "/search")
  809. pathname += ".php";
  810. const params = new URLSearchParams(window.location.search);
  811. const query = params.entries().q;
  812. const search = query ? `?q=${query}` : window.location.search;
  813. newURL = `${scheme}${selectedInstance}${pathname}${search}${hash}`;
  814. window.location.replace(newURL);
  815. }
  816. }
  817.  
  818. async function redirectGoodreads() {
  819. if (goodreads[0]) {
  820. window.stop();
  821.  
  822. selectedInstance = await getrandom(Instances.biblioreads);
  823.  
  824. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  825. if (window.location.pathname.startsWith("/search")) {
  826. const params = new URLSearchParams(window.location.search);
  827. newURL = `${scheme}${selectedInstance}${
  828. window.location.pathname
  829. }/${params.get("q")}${hash}`;
  830. }
  831. window.location.replace(newURL);
  832. }
  833. }
  834.  
  835. async function redirectStackoverflow() {
  836. if (
  837. stackoverflow[0] &&
  838. (window.location.pathname.startsWith("/questions/") ||
  839. window.location.pathname === "/")
  840. ) {
  841. window.stop();
  842. selectedInstance = stackoverflow[1]
  843. ? `${farsideInstance}/anonymousoverflow`
  844. : await getrandom(Instances.anonymousoverflow);
  845.  
  846. newURL = `${scheme}${selectedInstance}${window.location.pathname}${window.location.search}${hash}`;
  847. window.location.replace(newURL);
  848. }
  849. }
  850.  
  851. async function redirectBandcamp() {
  852. if (bandcamp[0]) {
  853. // thanks to libredirect
  854.  
  855. selectedInstance = await getrandom(Instances.tent);
  856. const params = new URLSearchParams(window.location.search);
  857.  
  858. if (
  859. `${window.location.hostname}${window.location.pathname}` ===
  860. "bandcamp.com/search"
  861. ) {
  862. newURL = `${scheme}${selectedInstance}/search.php?query=${params.get(
  863. "q"
  864. )}`;
  865. }
  866.  
  867. if (window.location.hostname.search(/(daily)?\.bandcamp\.com/) > 0) {
  868. const artist = window.location.hostname.replace(/\..+/, "");
  869. if (window.location.pathname === "/") {
  870. newURL = `${scheme}${selectedInstance}/artist.php?name=${artist}`;
  871. } else {
  872. const regex = /^\/(.+?)\/(.+)/.exec(window.location.pathname);
  873. if (regex) {
  874. const type = regex[1];
  875. const name = regex[2];
  876. newURL = `${scheme}${selectedInstance}/release.php?artist=${artist}&type=${type}&name=${name}`;
  877. }
  878. }
  879. }
  880.  
  881. if (window.location.hostname === "f4.bcbits.com") {
  882. const image = /^\/img\/(.+)/.exec(window.location.pathname)[1];
  883. newURL = `${scheme}${selectedInstance}/image.php?file=${image}`;
  884. }
  885.  
  886. if (window.location.hostname === "t4.bcbits.com") {
  887. const regex = /^\/stream\/([a-f0-9]+)\/(.+)\/([0-9]+)/.exec(
  888. window.location.pathname
  889. );
  890. if (regex) {
  891. const directory = regex[1];
  892. const format = regex[2];
  893. const file = regex[3];
  894. const token = params.get("token");
  895. newURL = `${scheme}${selectedInstance}/audio.php?directory=${directory}&format=${format}&file=${file}&token=${token}`;
  896. }
  897. }
  898.  
  899. if (newURL) window[(stop(), location.replace(newURL))];
  900. }
  901. }
  902.  
  903. async function redirectGenius() {
  904. if (genius[0]) {
  905. const searchpath = `${window.location.pathname}${window.location.search}`;
  906.  
  907. selectedInstance = await getrandom(Instances[geniusFrontend]);
  908. switch (geniusFrontend) {
  909. case "dumb":
  910. newURL = `${scheme}${selectedInstance}${searchpath}${hash}`;
  911. break;
  912. case "intellectual":
  913. if (window.location.pathname.endsWith("-lyrics")) {
  914. newURL = `${scheme}${selectedInstance}/lyrics?path=${searchpath.slice(
  915. 1
  916. )}${hash}`;
  917. } else if (window.location.pathname.startsWith("/albums/")) {
  918. newURL = `${scheme}${selectedInstance}${searchpath.replace(
  919. "/albums",
  920. "/album?path=albums"
  921. )}${hash}`;
  922. } else if (window.location.pathname.startsWith("/artists/")) {
  923. newURL = `${scheme}${selectedInstance}${searchpath.replace(
  924. "/artists",
  925. "/artist?path=artists"
  926. )}${hash}`;
  927. }
  928. break;
  929. }
  930.  
  931. if (newURL) window[(stop(), location.replace(newURL))];
  932. }
  933. }
  934.  
  935. async function redirectPinterest() {
  936. if (pinterest[0]) {
  937. selectedInstance = await getrandom(Instances.binternet);
  938.  
  939. if (window.location.hostname === "i.pinimg.com") {
  940. newURL = `${scheme}${selectedInstance}/image_proxy.php?url=${window.location.href}`;
  941. } else if (window.location.pathname.startsWith("/search")) {
  942. newURL = `${scheme}${selectedInstance}${window.location.pathname
  943. .replace("search", "search.php")
  944. .replace("/pins/", "")}${window.location.search}${hash}`;
  945. } else if (window.location.pathname === "/") {
  946. newURL = `${scheme}${selectedInstance}`;
  947. }
  948.  
  949. if (newURL) window[(stop(), location.replace(newURL))];
  950. }
  951. }
  952.  
  953. async function redirectSoundcloud() {
  954. if (soundcloud[0]) {
  955. window.stop();
  956. selectedInstance = await getrandom(Instances.tubo);
  957.  
  958. newURL = `${scheme}${selectedInstance}/kiosk?serviceId=1`;
  959. if (window.location.pathname !== "/") {
  960. newURL = `${scheme}${selectedInstance}/stream?url=${window.location.href}`;
  961. }
  962. window.location.replace(newURL);
  963. }
  964. }
  965.  
  966. const urlHostname = window.location.hostname;
  967.  
  968. switch (urlHostname) {
  969. case "www.instagram.com":
  970. redirectInstagram();
  971. break;
  972.  
  973. case "twitter.com":
  974. case "mobile.twitter.com":
  975. redirectTwitter();
  976. break;
  977.  
  978. case "www.youtube.com":
  979. case "m.youtube.com":
  980. case "www.youtube-nocookie.com":
  981. redirectYoutube(youtubeFrontend);
  982. break;
  983.  
  984. case "www.tiktok.com":
  985. redirectTiktok();
  986. break;
  987.  
  988. case "music.youtube.com":
  989. redirectYoutube(youtubeMusicFrontend);
  990. break;
  991.  
  992. case "news.ycombinator.com":
  993. redirectHackerNews();
  994. break;
  995.  
  996. case "translate.google.com":
  997. redirectGTranslate();
  998. break;
  999.  
  1000. case "www.reuters.com":
  1001. redirectReuters();
  1002. break;
  1003.  
  1004. case "www.imdb.com":
  1005. case "m.imdb.com":
  1006. redirectImdb();
  1007. break;
  1008.  
  1009. case "www.quora.com":
  1010. redirectQuora();
  1011. break;
  1012.  
  1013. case "www.google.com":
  1014. redirectGoogle();
  1015. break;
  1016.  
  1017. case "www.goodreads.com":
  1018. redirectGoodreads();
  1019. break;
  1020.  
  1021. case "genius.com":
  1022. redirectGenius();
  1023. break;
  1024.  
  1025. case "stackoverflow.com":
  1026. redirectStackoverflow();
  1027. break;
  1028.  
  1029. case "f4.bcbits.com":
  1030. case "t4.bcbits.com":
  1031. redirectBandcamp();
  1032. break;
  1033.  
  1034. case "i.pinimg.com":
  1035. redirectPinterest();
  1036. break;
  1037.  
  1038. case "soundcloud.com":
  1039. case "m.soundcloud.com":
  1040. redirectSoundcloud();
  1041. break;
  1042.  
  1043. case urlHostname.includes("reddit.com") ? urlHostname : 0:
  1044. redirectReddit();
  1045. break;
  1046.  
  1047. case urlHostname.includes("medium.com") ? urlHostname : 0:
  1048. redirectMedium();
  1049. break;
  1050.  
  1051. case urlHostname.includes("imgur.com") ? urlHostname : 0:
  1052. case urlHostname.includes("imgur.io") ? urlHostname : 0:
  1053. redirectImgur();
  1054. break;
  1055.  
  1056. case urlHostname.includes("wikipedia.org") ? urlHostname : 0:
  1057. redirectWikipedia();
  1058. break;
  1059.  
  1060. case urlHostname.includes("fandom.com") ? urlHostname : 0:
  1061. redirectFandom();
  1062. break;
  1063.  
  1064. case urlHostname.includes("bandcamp.com") ? urlHostname : 0:
  1065. redirectBandcamp();
  1066. break;
  1067.  
  1068. case urlHostname.includes("pinterest.com") ? urlHostname : 0:
  1069. redirectPinterest();
  1070. break;
  1071. }

QingJ © 2025

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