Skip to content

Commit a2578ac

Browse files
committed
Added Verified Badge to related videos
1 parent 1fee636 commit a2578ac

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/invidious/videos.cr

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,11 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)?
826826
.try &.dig?("runs", 0)
827827

828828
author = channel_info.try &.dig?("text")
829-
authorVerified = channel_info.try &.dig?("ownerBadges") != nil
829+
author_verified_badge = related["ownerBadges"]?.try do |badges_array|
830+
badges_array.as_a.find(&.dig("metadataBadgeRenderer", "tooltip").as_s.== "Verified")
831+
end
832+
833+
author_verified = (author_verified_badge && author_verified_badge.size > 0).to_s
830834
ucid = channel_info.try { |ci| HelperExtractors.get_browse_id(ci) }
831835

832836
# "4,088,033 views", only available on compact renderer
@@ -850,7 +854,7 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)?
850854
"length_seconds" => JSON::Any.new(length || "0"),
851855
"view_count" => JSON::Any.new(view_count || "0"),
852856
"short_view_count" => JSON::Any.new(short_view_count || "0"),
853-
"author_verified" => JSON::Any.new(authorVerified),
857+
"author_verified" => JSON::Any.new(author_verified),
854858
}
855859
end
856860

src/invidious/views/watch.ecr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ we're going to need to do it here in order to allow for translations.
314314
<h5 class="pure-g">
315315
<div class="pure-u-14-24">
316316
<% if rv["ucid"]? %>
317-
<b style="width:100%"><a href="/channel/<%= rv["ucid"] %>"><%= rv["author"]? %></a></b>
317+
<b style="width:100%"><a href="/channel/<%= rv["ucid"] %>"><%= rv["author"]? %><% if rv["author_verified"].== "true" %><i class="icon ion ion-md-checkmark-circle"></i><% end %></a></b>
318318
<% else %>
319-
<b style="width:100%"><%= rv["author"]? %></b>
319+
<b style="width:100%"><%= rv["author"]? %><% if rv["author_verified"].== "true" %><i class="icon ion ion-md-checkmark-circle"></i><% end %></b>
320320
<% end %>
321321
</div>
322322

0 commit comments

Comments
 (0)