From b3f90594527ae007594b95a780c0bf59021972a2 Mon Sep 17 00:00:00 2001
From: Omar Roth
"
+ end
+
+ if run["bold"]?
+ text = "#{text}"
+ end
+
+ if run["italics"]?
+ text = "#{text}"
+ end
+
+ if run["navigationEndpoint"]?
+ url = run["navigationEndpoint"]["urlEndpoint"]?.try &.["url"].as_s
+ if url
+ url = URI.parse(url)
+ url = HTTP::Params.parse(url.query.not_nil!)["q"]
+ else
+ url = run["navigationEndpoint"]["commandMetadata"]?.try &.["webCommandMetadata"]["url"].as_s
+ end
+
+ text = %(#{text})
+ end
+
+ text
+ end.join.rchop('\ufeff')
+
+ content, contentHtml = html_to_description(contentHtml)
author = node_comment["authorText"]?.try &.["simpleText"]
author ||= ""
@@ -1843,7 +1872,8 @@ get "/api/v1/comments/:id" do |env|
published = decode_date(node_comment["publishedTimeText"]["runs"][0]["text"].as_s.rchop(" (edited)"))
- json.field "content", content_text
+ json.field "content", content
+ json.field "contentHtml", contentHtml
json.field "published", published.epoch
json.field "likeCount", node_comment["likeCount"]
json.field "commentId", node_comment["commentId"]
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index 983a3e928..213ea8897 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -113,7 +113,7 @@ def template_youtube_comments(comments)
- #{recode_date(Time.epoch(child["published"].as_i64))} ago
#{child["contentHtml"]}
#{replies_html}