From a97e2cbe27e4777aeaa871ab2996ac593428bb6e Mon Sep 17 00:00:00 2001 From: syeopite Date: Mon, 30 Aug 2021 20:42:26 -0700 Subject: [PATCH] Add workaround for youtu.be links in comments --- src/invidious/comments.cr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 141a526d..cba425a5 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -552,7 +552,10 @@ 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 + elsif url.host == "youtu.be" + url = "/watch?v=#{url.request_target.lstrip('/')}" + elsif {"m.youtube.com", "www.youtube.com"}.includes? url if url.path == "/redirect" url = HTTP::Params.parse(url.query.not_nil!)["q"] else