summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonas-w <jonas-wunderlich@outlook.com>2022-02-04 17:55:22 +0100
committerjonas-w <jonas-wunderlich@outlook.com>2022-02-04 17:55:22 +0100
commita2578ac6b4a3ab370e2d1d483539ce9d32c272ca (patch)
tree6eeb91cf9fe4606d4c4b2fc353882a3f2b6e4e0b
parent1fee636afae81b45ee433b54077b41b4baf291ea (diff)
downloadinvidious-a2578ac6b4a3ab370e2d1d483539ce9d32c272ca.tar.gz
invidious-a2578ac6b4a3ab370e2d1d483539ce9d32c272ca.tar.bz2
invidious-a2578ac6b4a3ab370e2d1d483539ce9d32c272ca.zip
Added Verified Badge to related videos
-rw-r--r--src/invidious/videos.cr8
-rw-r--r--src/invidious/views/watch.ecr4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index a5ecdeea..69468b5e 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -826,7 +826,11 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)?
.try &.dig?("runs", 0)
author = channel_info.try &.dig?("text")
- authorVerified = channel_info.try &.dig?("ownerBadges") != nil
+ author_verified_badge = related["ownerBadges"]?.try do |badges_array|
+ badges_array.as_a.find(&.dig("metadataBadgeRenderer", "tooltip").as_s.== "Verified")
+ 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
@@ -850,7 +854,7 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)?
"length_seconds" => JSON::Any.new(length || "0"),
"view_count" => JSON::Any.new(view_count || "0"),
"short_view_count" => JSON::Any.new(short_view_count || "0"),
- "author_verified" => JSON::Any.new(authorVerified),
+ "author_verified" => JSON::Any.new(author_verified),
}
end
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 8422fce0..496ceddc 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -314,9 +314,9 @@ we're going to need to do it here in order to allow for translations.
<h5 class="pure-g">
<div class="pure-u-14-24">
<% if rv["ucid"]? %>
- <b style="width:100%"><a href="/channel/<%= rv["ucid"] %>"><%= rv["author"]? %></a></b>
+ <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>
<% else %>
- <b style="width:100%"><%= rv["author"]? %></b>
+ <b style="width:100%"><%= rv["author"]? %><% if rv["author_verified"].== "true" %><i class="icon ion ion-md-checkmark-circle"></i><% end %></b>
<% end %>
</div>