Add support for verified badges on comments

This commit is contained in:
syeopite 2021-04-07 02:16:20 -07:00
parent 814e8f14e2
commit 4f1cb26d96
No known key found for this signature in database
GPG Key ID: 6FA616E5A5294A82
4 changed files with 27 additions and 23 deletions

View File

@ -148,8 +148,10 @@ def fetch_youtube_comments(id, db, cursor, format, locale, thin_mode, region, so
content_html = node_comment["contentText"]?.try { |t| parse_content(t) } || "" content_html = node_comment["contentText"]?.try { |t| parse_content(t) } || ""
author = node_comment["authorText"]?.try &.["simpleText"]? || "" author = node_comment["authorText"]?.try &.["simpleText"]? || ""
author_verified = node_comment["authorCommentBadge"]?.try &.["authorCommentBadgeRenderer"]["iconTooltip"].to_s == "Verified" ? true : false || false
json.field "author", author json.field "author", author
json.field "author_verified", author_verified
json.field "authorThumbnails" do json.field "authorThumbnails" do
json.array do json.array do
node_comment["authorThumbnail"]["thumbnails"].as_a.each do |thumbnail| node_comment["authorThumbnail"]["thumbnails"].as_a.each do |thumbnail|
@ -319,7 +321,9 @@ def template_youtube_comments(comments, locale, thin_mode, is_replies = false)
<p> <p>
<b> <b>
<a class="#{child["authorIsChannelOwner"] == true ? "channel-owner" : ""}" href="#{child["authorUrl"]}">#{child["author"]}</a> <a class="#{child["authorIsChannelOwner"] == true ? "channel-owner" : ""}" href="#{child["authorUrl"]}">#{child["author"]}</a>
#{child["author_verified"]? == true ? "<a class=\"channel_badge\"><i class=\"icon ion-md-checkmark-circle\"></i></a>" : ""}
</b> </b>
</p>
<p style="white-space:pre-wrap">#{child["contentHtml"]}</p> <p style="white-space:pre-wrap">#{child["contentHtml"]}</p>
END_HTML END_HTML