Fix link redirect for YouTube comments

This commit is contained in:
Omar Roth 2018-09-09 09:18:31 -05:00
parent 133b72f9cf
commit 1c8bd671d8
2 changed files with 5 additions and 3 deletions

View file

@ -1917,8 +1917,12 @@ get "/api/v1/comments/:id" do |env|
if url
url = URI.parse(url)
if {"m.youtube.com", "www.youtube.com", "youtu.be"}.includes? url.host
if url.path == "/redirect"
url = HTTP::Params.parse(url.query.not_nil!)["q"]
else
url = url.full_path
end
end
else
url = run["navigationEndpoint"]["commandMetadata"]?.try &.["webCommandMetadata"]["url"].as_s