Propagate replacing yout.be links to /watch to RSS

pull/2380/head
syeopite 3 years ago
parent fd6f03655e
commit a28945273d
No known key found for this signature in database
GPG Key ID: 6FA616E5A5294A82

@ -481,12 +481,16 @@ def replace_links(html)
url = URI.parse(anchor["href"])
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"
params = HTTP::Params.parse(url.query.not_nil!)
anchor["href"] = params["q"]?
else
anchor["href"] = url.request_target
end
end
elsif url.to_s == "#"
begin
length_seconds = decode_length_seconds(anchor.content)

Loading…
Cancel
Save