Added Verified Badge to related videos
This commit is contained in:
parent
1fee636afa
commit
a2578ac6b4
2 changed files with 8 additions and 4 deletions
|
@ -826,7 +826,11 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)?
|
||||||
.try &.dig?("runs", 0)
|
.try &.dig?("runs", 0)
|
||||||
|
|
||||||
author = channel_info.try &.dig?("text")
|
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) }
|
ucid = channel_info.try { |ci| HelperExtractors.get_browse_id(ci) }
|
||||||
|
|
||||||
# "4,088,033 views", only available on compact renderer
|
# "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"),
|
"length_seconds" => JSON::Any.new(length || "0"),
|
||||||
"view_count" => JSON::Any.new(view_count || "0"),
|
"view_count" => JSON::Any.new(view_count || "0"),
|
||||||
"short_view_count" => JSON::Any.new(short_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
|
end
|
||||||
|
|
||||||
|
|
|
@ -314,9 +314,9 @@ we're going to need to do it here in order to allow for translations.
|
||||||
<h5 class="pure-g">
|
<h5 class="pure-g">
|
||||||
<div class="pure-u-14-24">
|
<div class="pure-u-14-24">
|
||||||
<% if rv["ucid"]? %>
|
<% 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 %>
|
<% 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 %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue