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 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/community.ecr b/src/invidious/views/community.ecr index 10ac5f04..3bc29e55 100644 --- a/src/invidious/views/community.ecr +++ b/src/invidious/views/community.ecr @@ -19,7 +19,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index 05478eeb..cc4ded74 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -8,7 +8,7 @@ "/> <% end %> -

<%= 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 @@
<% endpoint_params = "?v=#{item.id}" %> diff --git a/src/invidious/views/playlists.ecr b/src/invidious/views/playlists.ecr index 94d7a753..c8718e7b 100644 --- a/src/invidious/views/playlists.ecr +++ b/src/invidious/views/playlists.ecr @@ -19,7 +19,7 @@
- <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %> + <%= author %><% if !channel.verified.nil? && channel.verified %> <% end %>
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index bfd7821a..74a5e69f 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -206,7 +206,7 @@ we're going to need to do it here in order to allow for translations. <% if !video.author_thumbnail.empty? %> <% end %> - <%= author %><% if !video.author_verified.nil? && video.author_verified %> <% end %> + <%= author %><% if !video.author_verified.nil? && video.author_verified %> <% end %>
@@ -280,9 +280,9 @@ we're going to need to do it here in order to allow for translations.
<% if rv["ucid"]? %> - "><%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> + "><%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% else %> - <%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> + <%= rv["author"]? %><% if rv["author_verified"]? == "true" %> <% end %> <% end %>