// ==UserScript==
// @name Privacy Frontend Redirect
// @namespace Privacy Frontend Redirect
// @match *://*youtube.com/*
// @match *://*youtu.be/*
// @match *://*twitter.com/*
// @match *://*reddit.com/*
// @match *://*imgur.com/*
// @match *://*instagram.com/*
// @match *://*tiktok.com/*
// @match *://*imdb.com/*
// @match *://*fandom.com/*
// @match *://*translate.google.com/*
// @match *://*medium.com/*
// @match *://*news.ycombinator.com/*
// @grant none
// @version 1.1.1
// @author NoUser
// @description Redirect to privacy friendly front-ends of popular services.
// @run-at document-start
// @license MIT
// ==/UserScript==
// YouTube
const yt = ["https://piped.tokhmi.xyz/", "https://piped.mha.fi/", "https://piped.syncpundit.io/", "https://yewtu.be/", "https://vid.puffyan.us/", "https://inv.riverside.rocks/", "https://inv.vern.cc/", "https://invidious.snopyta.org/", "https://tube.cadence.moe/", "https://dev.viewtube.io/"]
const ryt = yt[Math.floor(Math.random() * yt.length)];
if (window.location.href.match(/^https:\/\/www\.youtube\.com\/watch\?v=*/)) { window.location.replace(ryt + window.location.href.substr(24,)) }
if (window.location.href.match(/^https:\/\/m\.youtube\.com\/watch\?v=*/)) { window.location.replace(ryt + window.location.href.substr(22,)) }
if (window.location.href.match(/^https:\/\/www\.youtube\.com\/shorts\//)) { window.location.replace(ryt + "watch?v=" + window.location.href.substr(31,)) }
if (window.location.href.match(/^https:\/\/youtu\.be\/*/)) { window.location.replace(ryt + window.location.href.substr(16,)) }
// Twitter
const twt = ["https://nitter.sneed.network", "https://canada.unofficialbird.com", "https://nitter.privacytools.io", "https://nitter.foss.wtf", "https://nitter.privacy.com.de", "https://nitter.1d4.us", "https://nitter.pussthecat.org", "https://nitter.poast.org", "https://twitter.censors.us"]
const rtwt = twt[Math.floor(Math.random() * twt.length)];
if (window.location.href.match(/^https:\/\/twitter\.com\//)) { window.location.replace(rtwt + window.location.pathname) }
if (window.location.href.match(/^https:\/\/mobile\.twitter\.com\//)) { window.location.replace(rtwt + window.location.pathname) }
// Reddit
const red = ["https://libreddit.eu.org", "https://libreddit.spike.codes", "https://lr.odyssey346.dev", "https://rd.funami.tech", "https://libreddit.dcs0.hu", "https://lr.vern.cc", "https://www.troddit.com"]
const rred = red[Math.floor(Math.random() * red.length)];
if (window.location.href.match(/^https:\/\/www\.reddit\.com\//)) { window.location.replace(rred + window.location.pathname) }
// Imgur
const img = ["https://rimgo.pussthecat.org", "https://rimgo.totaldarkness.net", "https://rimgo.vern.cc", "https://imgur.artemislena.eu", "https://rimgo.privacydev.net", "https://rimgo.bus-hit.me"]
const rimg = img[Math.floor(Math.random() * img.length)];
if (window.location.href.match(/^https:\/\/imgur\.com\//)) { window.location.replace(rimg + window.location.pathname) }
// Instagram
const ins = ["https://bibliogram.froth.zone", "https://ig.tokhmi.xyz", "https://bibliogram.priv.pw"]
const rins = ins[Math.floor(Math.random() * ins.length)];
if (window.location.href.match(/^https:\/\/instagram\.com\//)) { window.location.replace(rins + window.location.pathname) }
// TikTok
const tik = ["https://proxitok.pussthecat.org", "https://proxitok.esmailelbob.xyz", "https://tok.habedieeh.re", "https://tok.artemislena.eu", "https://proxitok.privacydev.net", "https://proxitok.manasiwibi.com"]
const rtik = tik[Math.floor(Math.random() * tik.length)];
if (window.location.href.match(/^https:\/\/tiktok\.com\//)) { window.location.replace(rtik + window.location.pathname) }
// IMDB
const imd = ["https://ld.vern.cc", "https://libremdb.esmailelbob.xyz", "https://lmdb.tokhmi.xyz", "https://libremdb.iket.me", "https://libremdb.pussthecat.org"]
const rimd = imd[Math.floor(Math.random() * imd.length)];
if (window.location.href.match(/^https:\/\/www\.imdb\.com\//)) { window.location.replace(rimd + window.location.pathname) }
// Fandom
const fan = ["https://bw.vern.cc", "https://breezewiki.esmailelbob.xyz", "https://bw.artemislena.eu", "https://breezewiki.pussthecat.org"]
const rfan = fan[Math.floor(Math.random() * fan.length)];
var sub = window.location.host.split('.')[0]
if (window.location.href.match(/^https:\/\/(.+)?\.fandom\.com\//)) { window.location.replace(rfan + "/" + sub + window.location.pathname) }
// Google Translate
const tr = ["https://lingva.ml", "https://translate.plausibility.cloud", "https://lingva.lunar.icu", "https://translate.projectsegfau.lt", "https://translate.jae.fi"]
const rtr = tr[Math.floor(Math.random() * tr.length)];
if (window.location.href.match(/^https:\/\/translate\.google\.com\//)) { window.location.replace(rtr + window.location.pathname) }
// Medium
const med = ["https://scribe.rip", "https://scribe.nixnet.services", "https://scribe.citizen4.eu", "https://scribe.bus-hit.me", "https://scribe.froth.zone", "https://scribe.rawbit.ninja"]
const rmed = med[Math.floor(Math.random() * med.length)];
if (window.location.href.match(/^https:\/\/.+\.medium\.com\//)) { window.location.replace(rmed + window.location.pathname) }
// Hacker News
const hn = ["https://www.hckrnws.com"]
const rhn = hn[Math.floor(Math.random() * hn.length)];
var storyid = window.location.href.split('=')[1]
if (window.location.href.match(/^https:\/\/news\.ycombinator\.com\//)) { window.location.replace(rhn + "/stories/" + storyid) }