2021-02-10 00:11:23 +00:00
|
|
|
from qutebrowser.api import interceptor
|
2023-04-08 19:28:19 +00:00
|
|
|
from PyQt6.QtCore import QUrl
|
2021-02-10 00:11:23 +00:00
|
|
|
|
2024-07-16 16:20:10 +00:00
|
|
|
basic = {
|
|
|
|
'tumblr.com' : 'priviblur.fly.dev',
|
|
|
|
'www.tumblr.com' : 'priviblur.fly.dev',
|
2021-02-10 00:11:23 +00:00
|
|
|
|
2024-07-16 16:20:10 +00:00
|
|
|
'avatar.wiki' : 'avatar.antifandom.com',
|
|
|
|
'portal.wiki' : 'theportalwiki.com',
|
|
|
|
'tardis.fandom.com' : 'tardis.wiki',
|
|
|
|
'zelda.fandom.com' : 'zeldawiki.wiki',
|
2022-03-09 19:13:21 +00:00
|
|
|
|
2024-07-16 16:20:10 +00:00
|
|
|
'discord.com' : 'canary.discord.com',
|
|
|
|
'news.ycombinator.com' : 'news.workers.tools',
|
|
|
|
'www.goodreads.com' : 'bl.vern.cc',
|
|
|
|
'www.npr.org' : 'text.npr.org',
|
|
|
|
'www.pixiv.net' : 'pixivfe.exozy.me',
|
|
|
|
'www.twitch.tv' : 'twineo.exozy.me',
|
|
|
|
}
|
|
|
|
farside = {
|
|
|
|
'music.youtube.com': 'invidious',
|
|
|
|
'www.youtube.com': 'invidious',
|
|
|
|
'youtu.be': 'invidious',
|
|
|
|
'youtube.com': 'invidious',
|
2022-03-09 19:13:21 +00:00
|
|
|
|
2024-07-16 16:20:10 +00:00
|
|
|
'old.reddit.com': 'redlib',
|
|
|
|
'reddit.com': 'redlib',
|
|
|
|
'www.reddit.com': 'redlib',
|
2024-02-29 18:14:11 +00:00
|
|
|
|
2024-07-16 16:20:10 +00:00
|
|
|
'mobile.twitter.com': 'nitter',
|
|
|
|
'twitter.com': 'nitter',
|
|
|
|
'x.com': 'nitter',
|
2021-02-03 03:20:48 +00:00
|
|
|
|
2024-07-16 16:20:10 +00:00
|
|
|
'vm.tiktok.com' : 'proxitok',
|
|
|
|
'www.tiktok.com' : 'proxitok',
|
2021-02-03 03:20:48 +00:00
|
|
|
|
2024-07-16 16:20:10 +00:00
|
|
|
'en.wikipedia.org' : 'wikiless',
|
|
|
|
'genius.com' : 'dumb',
|
|
|
|
'gothub.com' : 'gothub',
|
|
|
|
'imgur.com' : 'rimgo',
|
|
|
|
'medium.com' : 'scribe',
|
|
|
|
'stackoverflow.com' : 'anonymousoverflow',
|
|
|
|
'translate.google.com' : 'simplytranslate',
|
|
|
|
'www.instagram.com': 'proxigram',
|
|
|
|
'www.quora.com': 'querte',
|
|
|
|
}
|
2022-03-09 19:13:21 +00:00
|
|
|
|
2024-07-16 16:20:10 +00:00
|
|
|
def dosub(url: QUrl, host, sub):
|
|
|
|
url.setHost(host)
|
|
|
|
url.setPath('/' + sub + url.path())
|
|
|
|
def fandom(url: QUrl, sub):
|
|
|
|
dosub(url, 'farside.link', 'breezewiki/' + sub)
|
|
|
|
def tumblr(url: QUrl, sub):
|
|
|
|
dosub(url, 'priviblur.fly.dev', sub)
|
2021-02-03 03:20:48 +00:00
|
|
|
|
2024-07-16 16:20:10 +00:00
|
|
|
subs = {
|
|
|
|
'fandom.com' : fandom,
|
|
|
|
'tumblr.com' : tumblr,
|
|
|
|
}
|
2024-07-01 20:11:42 +00:00
|
|
|
|
2024-01-31 14:57:59 +00:00
|
|
|
def rewrite(info: interceptor.Request):
|
2021-11-08 21:38:08 +00:00
|
|
|
url = info.request_url
|
2024-07-16 16:20:10 +00:00
|
|
|
host = url.host()
|
|
|
|
base = '.'.join(host.split('.')[-2:])
|
|
|
|
|
|
|
|
bredir = basic.get(host)
|
|
|
|
fredir = farside.get(host)
|
|
|
|
sredir = subs.get(base)
|
|
|
|
|
|
|
|
if bredir is not None:
|
|
|
|
url.setHost(bredir)
|
2021-11-08 21:38:08 +00:00
|
|
|
info.redirect(url)
|
2024-07-16 16:20:10 +00:00
|
|
|
elif fredir is not None:
|
|
|
|
url.setHost('farside.link')
|
|
|
|
url.setPath('/' + fredir + url.path())
|
|
|
|
info.redirect(url)
|
|
|
|
elif sredir is not None:
|
|
|
|
sub = host.split('.')[0]
|
|
|
|
sredir(url, sub)
|
|
|
|
info.redirect(url)
|
|
|
|
|
2024-01-31 14:57:59 +00:00
|
|
|
interceptor.register(rewrite)
|