mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-14 16:48:29 +00:00
Add support for verified badges on playlist results
This commit is contained in:
parent
b079b46ddb
commit
814e8f14e2
@ -345,6 +345,7 @@ def extract_item(item : JSON::Any, author_fallback : String? = nil, author_id_fa
|
|||||||
title: title,
|
title: title,
|
||||||
id: plid,
|
id: plid,
|
||||||
author: author_fallback || "",
|
author: author_fallback || "",
|
||||||
|
author_verified: false,
|
||||||
ucid: author_id_fallback || "",
|
ucid: author_id_fallback || "",
|
||||||
video_count: video_count,
|
video_count: video_count,
|
||||||
videos: [] of SearchPlaylistVideo,
|
videos: [] of SearchPlaylistVideo,
|
||||||
@ -360,6 +361,7 @@ def extract_item(item : JSON::Any, author_fallback : String? = nil, author_id_fa
|
|||||||
author_info = i["shortBylineText"]?.try &.["runs"]?.try &.as_a?.try &.[0]?
|
author_info = i["shortBylineText"]?.try &.["runs"]?.try &.as_a?.try &.[0]?
|
||||||
author = author_info.try &.["text"].as_s || author_fallback || ""
|
author = author_info.try &.["text"].as_s || author_fallback || ""
|
||||||
author_id = author_info.try &.["navigationEndpoint"]?.try &.["browseEndpoint"]["browseId"].as_s || author_id_fallback || ""
|
author_id = author_info.try &.["navigationEndpoint"]?.try &.["browseEndpoint"]["browseId"].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
|
||||||
|
|
||||||
videos = i["videos"]?.try &.as_a.map do |v|
|
videos = i["videos"]?.try &.as_a.map do |v|
|
||||||
v = v["childVideoRenderer"]
|
v = v["childVideoRenderer"]
|
||||||
@ -379,6 +381,7 @@ def extract_item(item : JSON::Any, author_fallback : String? = nil, author_id_fa
|
|||||||
title: title,
|
title: title,
|
||||||
id: plid,
|
id: plid,
|
||||||
author: author,
|
author: author,
|
||||||
|
author_verified: author_verified,
|
||||||
ucid: author_id,
|
ucid: author_id,
|
||||||
video_count: video_count,
|
video_count: video_count,
|
||||||
videos: videos,
|
videos: videos,
|
||||||
|
@ -131,6 +131,7 @@ struct SearchPlaylist
|
|||||||
property title : String
|
property title : String
|
||||||
property id : String
|
property id : String
|
||||||
property author : String
|
property author : String
|
||||||
|
property author_verified : Bool
|
||||||
property ucid : String
|
property ucid : String
|
||||||
property video_count : Int32
|
property video_count : Int32
|
||||||
property videos : Array(SearchPlaylistVideo)
|
property videos : Array(SearchPlaylistVideo)
|
||||||
|
@ -37,6 +37,9 @@
|
|||||||
<p>
|
<p>
|
||||||
<b>
|
<b>
|
||||||
<a style="width:100%" href="/channel/<%= item.ucid %>"><%= item.author %></a>
|
<a style="width:100%" href="/channel/<%= item.ucid %>"><%= item.author %></a>
|
||||||
|
<% if item.is_a?(SearchPlaylist) && item.author_verified %>
|
||||||
|
<a class="channel_badge"><i class="icon ion-md-checkmark-circle"></i></a>
|
||||||
|
<% end %>
|
||||||
</b>
|
</b>
|
||||||
</p>
|
</p>
|
||||||
<% when MixVideo %>
|
<% when MixVideo %>
|
||||||
|
Loading…
Reference in New Issue
Block a user