Privacy Redirector

Redirect social media platforms to their privacy respecting frontends

目前為 2022-07-01 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Privacy Redirector
  3. // @name:tr Gizlilik Yönlendiricisi
  4. // @namespace https://github.com/dybdeskarphet/privacy-redirector
  5. // @license GPLv3
  6. // @version 1.2.7
  7. // @description Redirect social media platforms to their privacy respecting frontends
  8. // @description:tr Sosyal medya platformlarını, gizliliğe saygı duyan önyüzlerine yönlendirir
  9. // @supportURL https://github.com/dybdeskarphet/privacy-redirector
  10. // @run-at document-start
  11. // @match *://instagram.com/*
  12. // @match *://*.instagram.com/*
  13. // @match *://twitter.com/*
  14. // @match *://*.twitter.com/*
  15. // @match *://reddit.com/*
  16. // @match *://*.reddit.com/*
  17. // @match *://youtube.com/*
  18. // @match *://*.youtube.com/*
  19. // @match *://*.tiktok.com/*
  20. // @match *://imgur.com/*
  21. // @match *://*.imgur.com/*
  22. // @match *://medium.com/*
  23. // @match *://*.medium.com/*
  24. // @match *://translate.google.com/*
  25. // @match *://news.ycombinator.com/*
  26. // @match *://*.reuters.com/*
  27. // @match *://*.wikipedia.org/*
  28. // ==/UserScript==
  29.  
  30. /*
  31. ___ _ _ ___ _____ _____
  32. / _ \| \ | | / _ \| ___| ___|
  33. | | | | \| |_____| | | | |_ | |_
  34. | |_| | |\ |_____| |_| | _| | _|
  35. \___/|_| \_| \___/|_| |_|
  36.  
  37. CHANGE THE RELEVANT VALUE TO "false" TO
  38. DISABLE THE REDIRECTION FOR THAT
  39. PARTICULAR SITE */
  40. var redirect_youtube = true;
  41. var redirect_instagram = true;
  42. var redirect_twitter = true;
  43. var redirect_reddit = true;
  44. var redirect_tiktok = true;
  45. var redirect_imgur = true;
  46. var redirect_medium = true;
  47. var redirect_hackernews = true;
  48. var redirect_gtranslate = true;
  49. var redirect_reuters = true;
  50. var redirect_wikipedia = true;
  51.  
  52. // // // // // // // // // // // // //
  53.  
  54. var farsideInstance = "farside.link";
  55. var debug_mode = false;
  56.  
  57. if (debug_mode == true) {
  58. alert("Path: " + window.location.pathname + "\nQuery: " + window.location.search + "\nHash: " + window.location.hash)
  59. }
  60.  
  61. function redirectInstagram() {
  62. if (redirect_instagram == false) {
  63. return;
  64. }
  65.  
  66. window.stop();
  67.  
  68. let bibliogramInstances = [
  69. 'bibliogram.art',
  70. 'bibliogram.pussthecat.org',
  71. 'bibliogram.1d4.us',
  72. 'bibliogram.froth.zone'
  73. ];
  74.  
  75. let randomInstance = bibliogramInstances[Math.floor(Math.random()*bibliogramInstances.length)];
  76.  
  77. if (window.location.pathname.startsWith("/accounts/login/")) {
  78. if (window.location.search.indexOf("/reel/") != -1) { // reels
  79. let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname.replace("/accounts/login/", "/") + window.location.search.replace("?next=/reel", "p") + window.location.hash;
  80. window.location.replace(newURL);
  81. } else if (window.location.search.indexOf("/p/") == -1) { // user pages - it will break if it's not the second last block
  82. let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname.replace("/accounts/login/", "/") + window.location.search.replace("?next=", "u") + window.location.hash;
  83. window.location.replace(newURL);
  84. } else { // probably a post
  85. let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname.replace("/accounts/login/", "") + window.location.search.replace("?next=", "") + window.location.hash;
  86. window.location.replace(newURL);
  87. }
  88. } else {
  89. if (window.location.pathname == "/") { // home page
  90. location.hostname = randomInstance
  91. } else if (window.location.pathname.startsWith("/reel/")) { // reel
  92. let newURL = window.location.protocol + "//" + randomInstance + window.location.pathname.replace("/reel", "/p") + window.location.hash;
  93. window.location.replace(newURL);
  94. } else if (! window.location.pathname.startsWith("/p/")) { // user page - it will break if it's not the second last block
  95. let newURL = window.location.protocol + "//" + randomInstance + "/u" + window.location.pathname + window.location.search + window.location.hash;
  96. window.location.replace(newURL);
  97. } else { // probably a post
  98. location.hostname = randomInstance
  99. }
  100. }
  101. }
  102.  
  103. function redirectTwitter() {
  104. if (redirect_twitter == false) {
  105. return;
  106. }
  107.  
  108. window.stop();
  109.  
  110. let newURL = window.location.protocol + "//" + farsideInstance + "/nitter" + window.location.pathname + window.location.search + window.location.hash;
  111. window.location.replace(newURL);
  112. }
  113.  
  114. function redirectReddit() {
  115. if (redirect_reddit == false) {
  116. return;
  117. }
  118.  
  119. window.stop();
  120.  
  121. let farsideLibreddit = farsideInstance + "/libreddit";
  122. let farsideTeddit = farsideInstance + "/teddit";
  123.  
  124. if (window.location.hostname == "old.reddit.com") {
  125. let newURL = window.location.protocol + "//" + farsideTeddit + window.location.pathname + window.location.search + window.location.hash;
  126. window.location.replace(newURL);
  127. } else {
  128. let newURL = window.location.protocol + "//" + farsideLibreddit + window.location.pathname + window.location.search + window.location.hash;
  129. window.location.replace(newURL);
  130. }
  131. }
  132.  
  133. function redirectYoutube() {
  134. if (redirect_youtube == false) {
  135. return;
  136. }
  137.  
  138. window.stop();
  139.  
  140. let newURL = window.location.protocol + "//" + farsideInstance + "/invidious" + window.location.pathname + window.location.search + window.location.hash;
  141. window.location.replace(newURL);
  142. }
  143.  
  144. function redirectTiktok() {
  145. if (redirect_tiktok == false) {
  146. return;
  147. }
  148.  
  149. window.stop();
  150.  
  151. if (window.location.pathname.startsWith("/discover")) {
  152. let newURL = window.location.protocol + "//" + "proxitok.herokuapp.com" + window.location.pathname.replace("discover", "tag") + window.location.hash;
  153. window.location.replace(newURL);
  154. } else if (window.location.pathname.search(/[a-z][a-z]\-[A-Z][A-Z]/g) != -1) {
  155. let newURL = window.location.protocol + "//" + "proxitok.pussthecat.org";
  156. window.location.replace(newURL);
  157. } else {
  158. location.hostname = "proxitok.pussthecat.org";
  159. }
  160.  
  161. }
  162.  
  163. function redirectImgur() {
  164. if (redirect_imgur == false) {
  165. return;
  166. }
  167.  
  168. window.stop();
  169.  
  170. let newURL = window.location.protocol + "//" + farsideInstance + "/rimgo" + window.location.pathname + window.location.search + window.location.hash;
  171. window.location.replace(newURL);
  172. }
  173.  
  174. function redirectMedium() {
  175. if (redirect_medium == false || window.location.pathname == "/") {
  176. return;
  177. }
  178.  
  179. window.stop();
  180.  
  181. let newURL = window.location.protocol + "//" + farsideInstance + "/scribe" + window.location.pathname + window.location.search + window.location.hash;
  182. window.location.replace(newURL);
  183. }
  184.  
  185. function redirectYoutubeMusic() {
  186. if (redirect_youtube == false) {
  187. return;
  188. }
  189.  
  190. window.stop();
  191.  
  192. if (window.location.pathname.startsWith("/playlist")) {
  193. let newURL = window.location.protocol + "//" + "beatbump.ml" + window.location.pathname + window.location.search.replace("?list=", "/VL") + window.location.hash;
  194. window.location.replace(newURL);
  195. } else if (window.location.pathname.startsWith("/channel")) {
  196. let newURL = window.location.protocol + "//" + "beatbump.ml" + window.location.pathname.replace("/channel", "/artist") + window.location.search + window.location.hash;
  197. window.location.replace(newURL);
  198. } else if (window.location.pathname.startsWith("/explore")) {
  199. let newURL = window.location.protocol + "//" + "beatbump.ml" + window.location.pathname.replace("/explore", "/trending") + window.location.search + window.location.hash;
  200. window.location.replace(newURL);
  201. } else if (window.location.pathname.startsWith("/moods_and_genres")) {
  202. let newURL = window.location.protocol + "//" + "beatbump.ml" + window.location.pathname.replace("/moods_and_genres", "/explore") + window.location.search + window.location.hash;
  203. window.location.replace(newURL);
  204. } else {
  205. location.hostname = "beatbump.ml";
  206. }
  207.  
  208. }
  209.  
  210. function redirectHackerNews() {
  211. if (redirect_hackernews == false) {
  212. return;
  213. }
  214.  
  215. window.stop();
  216. let newURL = window.location.protocol + "//" + "hn.algolia.com";
  217. window.location.replace(newURL);
  218. }
  219.  
  220. function redirectGTranslate() {
  221. if (redirect_gtranslate == false) {
  222. return;
  223. }
  224.  
  225. window.stop();
  226.  
  227.  
  228. if (window.location.search != "") {
  229. let newURL = window.location.protocol + "//" + farsideInstance + "/lingva" + window.location.pathname + window.location.search.replace(/\?hl=tr/, "").replace(/.sl=/, "").replace("&tl=", "/").replace("&text=", "/").replace("&op=translate", "") + window.location.hash;
  230. window.location.replace(newURL);
  231. } else {
  232. let newURL = window.location.protocol + "//" + farsideInstance + "/lingva";
  233. window.location.replace(newURL);
  234. }
  235. }
  236.  
  237. function redirectReuters() {
  238. if (redirect_reuters == false) {
  239. return;
  240. }
  241.  
  242. window.stop();
  243. location.hostname = "neuters.de";
  244. }
  245.  
  246. function redirectWikipedia() {
  247. if (redirect_wikipedia == false) {
  248. return;
  249. }
  250. let langCodeIndex = window.location.hostname.search(/^[a-z][a-z]\./)
  251.  
  252. window.stop();
  253.  
  254. if (langCodeIndex != -1) {
  255. let newURL = window.location.protocol + "//" + farsideInstance + "/wikiless" + window.location.pathname + "?lang=" + window.location.hostname[langCodeIndex] + window.location.hostname[langCodeIndex + 1] + window.location.hash;
  256. window.location.replace(newURL);
  257. } else {
  258. let newURL = window.location.protocol + "//" + farsideInstance + "/wikiless" + window.location.pathname + "?lang=en" + window.location.hash;
  259. window.location.replace(newURL);
  260. }
  261. }
  262.  
  263. var urlHostname = window.location.hostname;
  264.  
  265. switch (urlHostname) {
  266.  
  267. case "www.instagram.com":
  268. redirectInstagram();
  269. break;
  270.  
  271. case "twitter.com":
  272. case "mobile.twitter.com":
  273. redirectTwitter();
  274. break;
  275.  
  276. case "www.reddit.com":
  277. case "old.reddit.com":
  278. redirectReddit();
  279. break;
  280.  
  281. case "www.youtube.com":
  282. case "m.youtube.com":
  283. redirectYoutube();
  284. break;
  285.  
  286. case "www.tiktok.com":
  287. redirectTiktok();
  288. break;
  289.  
  290. case "music.youtube.com":
  291. redirectYoutubeMusic();
  292. break;
  293.  
  294. case "news.ycombinator.com":
  295. redirectHackerNews();
  296. break;
  297.  
  298. case "translate.google.com":
  299. redirectGTranslate();
  300. break;
  301.  
  302. case "www.reuters.com":
  303. redirectReuters();
  304. break;
  305. }
  306.  
  307. if (urlHostname.includes("medium.com")) {
  308. redirectMedium();
  309. } else if (urlHostname.includes("imgur.com")) {
  310. redirectImgur();
  311. } else if (urlHostname.includes("wikipedia.org")) {
  312. redirectWikipedia();
  313. }

QingJ © 2025

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