mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Properly transform youtu.be links to be /watch routes in comments and descriptions (#2365)
This commit is contained in:
parent
f938aa530e
commit
a1001ada47
1 changed files with 3 additions and 1 deletions
|
@ -552,7 +552,9 @@ def content_to_comment_html(content)
|
|||
if url = run["navigationEndpoint"]["urlEndpoint"]?.try &.["url"].as_s
|
||||
url = URI.parse(url)
|
||||
|
||||
if !url.host || {"m.youtube.com", "www.youtube.com", "youtu.be"}.includes? url.host
|
||||
if url.host == "youtu.be"
|
||||
url = "/watch?v=#{url.request_target.lstrip('/')}"
|
||||
elsif !url.host || {"m.youtube.com", "www.youtube.com"}.includes? url
|
||||
if url.path == "/redirect"
|
||||
url = HTTP::Params.parse(url.query.not_nil!)["q"]
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue