mirror of
https://github.com/Phantop/dotfiles
synced 2024-11-24 07:42:54 +00:00
qute: update redirect for invidious not working anymore
This commit is contained in:
parent
1698643bac
commit
ee735ad299
|
@ -2,5 +2,5 @@ function ytflux
|
||||||
set cat (cat ~/.config/miniflux)/categories/3
|
set cat (cat ~/.config/miniflux)/categories/3
|
||||||
set entries (eval curl $cat/entries?status=unread | jq -r .entries[].url)
|
set entries (eval curl $cat/entries?status=unread | jq -r .entries[].url)
|
||||||
eval curl -X PUT $cat/mark-all-as-read
|
eval curl -X PUT $cat/mark-all-as-read
|
||||||
parallel -u "yt-dlp $argv (trurl -s host=youtube.com {})" ::: $entries
|
parallel -u "yt-dlp $argv {}" ::: $entries
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,11 +18,6 @@ basic = {
|
||||||
'www.twitch.tv' : 'twineo.exozy.me',
|
'www.twitch.tv' : 'twineo.exozy.me',
|
||||||
}
|
}
|
||||||
farside = {
|
farside = {
|
||||||
'music.youtube.com': 'invidious',
|
|
||||||
'www.youtube.com': 'invidious',
|
|
||||||
'youtu.be': 'invidious',
|
|
||||||
'youtube.com': 'invidious',
|
|
||||||
|
|
||||||
'old.reddit.com': 'redlib',
|
'old.reddit.com': 'redlib',
|
||||||
'reddit.com': 'redlib',
|
'reddit.com': 'redlib',
|
||||||
'www.reddit.com': 'redlib',
|
'www.reddit.com': 'redlib',
|
||||||
|
@ -58,6 +53,17 @@ subs = {
|
||||||
'tumblr.com' : tumblr,
|
'tumblr.com' : tumblr,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def youtube(info: interceptor.Request, url: QUrl):
|
||||||
|
url = url.toString()
|
||||||
|
nurl = url.replace("watch?v=", "embed/")
|
||||||
|
|
||||||
|
if nurl != url:
|
||||||
|
info.redirect(QUrl(nurl))
|
||||||
|
|
||||||
|
custom = {
|
||||||
|
'www.youtube.com' : youtube,
|
||||||
|
}
|
||||||
|
|
||||||
def rewrite(info: interceptor.Request):
|
def rewrite(info: interceptor.Request):
|
||||||
url = info.request_url
|
url = info.request_url
|
||||||
host = url.host()
|
host = url.host()
|
||||||
|
@ -66,6 +72,7 @@ def rewrite(info: interceptor.Request):
|
||||||
bredir = basic.get(host)
|
bredir = basic.get(host)
|
||||||
fredir = farside.get(host)
|
fredir = farside.get(host)
|
||||||
sredir = subs.get(base)
|
sredir = subs.get(base)
|
||||||
|
credir = custom.get(host)
|
||||||
|
|
||||||
if bredir is not None:
|
if bredir is not None:
|
||||||
url.setHost(bredir)
|
url.setHost(bredir)
|
||||||
|
@ -78,5 +85,7 @@ def rewrite(info: interceptor.Request):
|
||||||
sub = host.split('.')[0]
|
sub = host.split('.')[0]
|
||||||
sredir(url, sub)
|
sredir(url, sub)
|
||||||
info.redirect(url)
|
info.redirect(url)
|
||||||
|
elif credir is not None:
|
||||||
|
credir(info, url)
|
||||||
|
|
||||||
interceptor.register(rewrite)
|
interceptor.register(rewrite)
|
||||||
|
|
Loading…
Reference in a new issue