mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Propagate replacing yout.be links to /watch to RSS
This commit is contained in:
parent
fd6f03655e
commit
a28945273d
1 changed files with 8 additions and 4 deletions
|
@ -481,12 +481,16 @@ def replace_links(html)
|
||||||
url = URI.parse(anchor["href"])
|
url = URI.parse(anchor["href"])
|
||||||
|
|
||||||
if {"www.youtube.com", "m.youtube.com", "youtu.be"}.includes?(url.host)
|
if {"www.youtube.com", "m.youtube.com", "youtu.be"}.includes?(url.host)
|
||||||
|
if url.host == "youtu.be"
|
||||||
|
url = "/watch?v=#{url.request_target.lstrip('/')}"
|
||||||
|
else
|
||||||
if url.path == "/redirect"
|
if url.path == "/redirect"
|
||||||
params = HTTP::Params.parse(url.query.not_nil!)
|
params = HTTP::Params.parse(url.query.not_nil!)
|
||||||
anchor["href"] = params["q"]?
|
anchor["href"] = params["q"]?
|
||||||
else
|
else
|
||||||
anchor["href"] = url.request_target
|
anchor["href"] = url.request_target
|
||||||
end
|
end
|
||||||
|
end
|
||||||
elsif url.to_s == "#"
|
elsif url.to_s == "#"
|
||||||
begin
|
begin
|
||||||
length_seconds = decode_length_seconds(anchor.content)
|
length_seconds = decode_length_seconds(anchor.content)
|
||||||
|
|
Loading…
Reference in a new issue