mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-12 23:58:31 +00:00
Add support for verified badges on channel results
This commit is contained in:
parent
84cc2dfe48
commit
b079b46ddb
@ -314,6 +314,8 @@ def extract_item(item : JSON::Any, author_fallback : String? = nil, author_id_fa
|
||||
author = i["title"]["simpleText"]?.try &.as_s || author_fallback || ""
|
||||
author_id = i["channelId"]?.try &.as_s || author_id_fallback || ""
|
||||
|
||||
author_verified = i["ownerBadges"]?.try &.as_a[0]["metadataBadgeRenderer"]?.try &.["style"]?.try &.to_s == "BADGE_STYLE_TYPE_VERIFIED" ? true : false || false
|
||||
|
||||
author_thumbnail = i["thumbnail"]["thumbnails"]?.try &.as_a[0]?.try &.["url"]?.try &.as_s || ""
|
||||
subscriber_count = i["subscriberCountText"]?.try &.["simpleText"]?.try &.as_s.try { |s| short_text_to_number(s.split(" ")[0]) } || 0
|
||||
|
||||
@ -324,6 +326,7 @@ def extract_item(item : JSON::Any, author_fallback : String? = nil, author_id_fa
|
||||
|
||||
SearchChannel.new({
|
||||
author: author,
|
||||
author_verified: author_verified,
|
||||
ucid: author_id,
|
||||
author_thumbnail: author_thumbnail,
|
||||
subscriber_count: subscriber_count,
|
||||
|
@ -181,6 +181,7 @@ struct SearchChannel
|
||||
include DB::Serializable
|
||||
|
||||
property author : String
|
||||
property author_verified : Bool
|
||||
property ucid : String
|
||||
property author_thumbnail : String
|
||||
property subscriber_count : Int32
|
||||
|
@ -8,7 +8,12 @@
|
||||
<img style="width:56.25%" src="/ggpht<%= URI.parse(item.author_thumbnail).request_target.gsub(/=s\d+/, "=s176") %>"/>
|
||||
</center>
|
||||
<% end %>
|
||||
<p><%= item.author %></p>
|
||||
<p>
|
||||
<%= item.author %>
|
||||
<% if item.author_verified %>
|
||||
<a class="channel_badge"><i class="icon ion-md-checkmark-circle"></i></a>
|
||||
<% end %>
|
||||
</p>
|
||||
</a>
|
||||
<p><%= translate(locale, "`x` subscribers", number_with_separator(item.subscriber_count)) %></p>
|
||||
<% if !item.auto_generated %><p><%= translate(locale, "`x` videos", number_with_separator(item.video_count)) %></p><% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user