From b893bdac0d6b76a61e2cd972b29e44cf5b9c88f0 Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Tue, 7 Feb 2023 22:02:35 -0500
Subject: [PATCH 1/2] parse isPinned, add support for strikethrough
---
src/invidious/comments.cr | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index d691ca36..357a461c 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -181,6 +181,8 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
json.field "content", html_to_content(content_html)
json.field "contentHtml", content_html
+ json.field "isPinned", (node_comment["pinnedCommentBadge"]? != nil)
+
json.field "published", published.to_unix
json.field "publishedText", translate(locale, "`x` ago", recode_date(published, locale))
@@ -670,6 +672,7 @@ def content_to_comment_html(content, video_id : String? = "")
end
text = "#{text}" if run["bold"]?
+ text = "#{text}" if run["strikethrough"]?
text = "#{text}" if run["italics"]?
text
From e0c70d34cc3f937149d5c36c76aed8d8b57b4de5 Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Thu, 9 Feb 2023 17:13:21 -0500
Subject: [PATCH 2/2] Make sure pinnedCommentBadge isn't equal to false
Co-authored-by: Samantaz Fox
---
src/invidious/comments.cr | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index 357a461c..41b0efa8 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -181,7 +181,7 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
json.field "content", html_to_content(content_html)
json.field "contentHtml", content_html
- json.field "isPinned", (node_comment["pinnedCommentBadge"]? != nil)
+ json.field "isPinned", (node_comment["pinnedCommentBadge"]?.try(&.as_bool) == true)
json.field "published", published.to_unix
json.field "publishedText", translate(locale, "`x` ago", recode_date(published, locale))