diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index 33613260..d48fd1fb 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -71,9 +71,10 @@ def get_about_info(ucid, locale) : AboutChannel # if banner.includes? "channels/c4/default_banner" # banner = nil # end - author_verified_badges = initdata["header"]?.try &.["c4TabbedHeaderRenderer"]?.try &.["badges"]? + # author_verified_badges = initdata["header"]?.try &.["c4TabbedHeaderRenderer"]?.try &.["badges"]? + author_verified_badge = initdata["header"].dig?("c4TabbedHeaderRenderer", "badges", 0, "metadataBadgeRenderer", "tooltip") + author_verified = (author_verified_badge && author_verified_badge == "Verified") - author_verified = (author_verified_badges && author_verified_badges.size > 0) description = initdata["metadata"]["channelMetadataRenderer"]?.try &.["description"]?.try &.as_s? || "" description_html = HTML.escape(description) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 5215122e..d94f213f 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -145,8 +145,9 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b content_html = node_comment["contentText"]?.try { |t| parse_content(t) } || "" author = node_comment["authorText"]?.try &.["simpleText"]? || "" - verified = (node_comment["authorCommentBadge"]? != nil) - json.field "verified", (verified || false) + + json.field "verified", (node_comment["authorCommentBadge"]? != nil) + json.field "author", author json.field "authorThumbnails" do json.array do diff --git a/src/invidious/helpers/serialized_yt_data.cr b/src/invidious/helpers/serialized_yt_data.cr index 186bca25..3918bd13 100644 --- a/src/invidious/helpers/serialized_yt_data.cr +++ b/src/invidious/helpers/serialized_yt_data.cr @@ -142,7 +142,9 @@ struct SearchPlaylist json.field "author", self.author json.field "authorId", self.ucid json.field "authorUrl", "/channel/#{self.ucid}" + json.field "authorVerified", self.author_verified + json.field "videoCount", self.video_count json.field "videos" do json.array do diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index bbf3afa2..66952c93 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -594,7 +594,7 @@ struct Video end def author_verified : Bool - info["authorVerified"].as_bool + info["authorVerified"].try &.as_bool || false end def sub_count_text : String @@ -854,6 +854,7 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)? end author_verified = (author_verified_badge && author_verified_badge.size > 0).to_s + ucid = channel_info.try { |ci| HelperExtractors.get_browse_id(ci) } # "4,088,033 views", only available on compact renderer @@ -1071,9 +1072,10 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ author_info = video_secondary_renderer.try &.dig?("owner", "videoOwnerRenderer") author_thumbnail = author_info.try &.dig?("thumbnail", "thumbnails", 0, "url") - author_verified_badge = author_info.try &.["badges"]? - params["authorVerified"] = JSON::Any.new((author_verified_badge && author_verified_badge.size > 0) || false) + author_verified_badge = author_info.try &.dig?("badges", 0, "metadataBadgeRenderer", "tooltip") + params["authorVerified"] = JSON::Any.new((author_verified_badge && author_verified_badge == "Verified")) + params["authorThumbnail"] = JSON::Any.new(author_thumbnail.try &.as_s || "") params["subCountText"] = JSON::Any.new(author_info.try &.["subscriberCountText"]? diff --git a/src/invidious/views/channel.ecr b/src/invidious/views/channel.ecr index 197c636b..92f81ee4 100644 --- a/src/invidious/views/channel.ecr +++ b/src/invidious/views/channel.ecr @@ -20,7 +20,7 @@
<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %> <% end %>
+<%= HTML.escape(item.author) %><% if !item.author_verified.nil? && item.author_verified %> <% end %>
<%= translate_count(locale, "generic_subscribers_count", item.subscriber_count, NumberFormatting::Separator) %>
<% if !item.auto_generated %><%= translate_count(locale, "generic_videos_count", item.video_count, NumberFormatting::Separator) %>
<% end %> @@ -30,7 +30,7 @@<%= HTML.escape(item.title) %>
-<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>
+<%= HTML.escape(item.author) %><% if !item.is_a?(InvidiousPlaylist) && !item.author_verified.nil? && item.author_verified %> <% end %>
<% when MixVideo %> @@ -45,7 +45,7 @@<%= HTML.escape(item.title) %>
-<%= HTML.escape(item.author) %><% if !item.is_a?(MixVideo) && !item.author_verified.nil? && item.author_verified %> <% end %>
+<%= HTML.escape(item.author) %>
<% when PlaylistVideo %> @@ -142,7 +142,7 @@