forked from midou/invidious
Added verification badge to video player and error with related_videos
This commit is contained in:
parent
154bca4635
commit
1fee636afa
@ -570,6 +570,10 @@ struct Video
|
|||||||
info["authorThumbnail"]?.try &.as_s || ""
|
info["authorThumbnail"]?.try &.as_s || ""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def author_verified : Bool
|
||||||
|
info["authorVerified"].as_bool
|
||||||
|
end
|
||||||
|
|
||||||
def sub_count_text : String
|
def sub_count_text : String
|
||||||
info["subCountText"]?.try &.as_s || "-"
|
info["subCountText"]?.try &.as_s || "-"
|
||||||
end
|
end
|
||||||
@ -822,6 +826,7 @@ 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
|
||||||
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
|
||||||
@ -845,6 +850,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),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1037,7 +1043,7 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_
|
|||||||
|
|
||||||
author_info = video_secondary_renderer.try &.dig?("owner", "videoOwnerRenderer")
|
author_info = video_secondary_renderer.try &.dig?("owner", "videoOwnerRenderer")
|
||||||
author_thumbnail = author_info.try &.dig?("thumbnail", "thumbnails", 0, "url")
|
author_thumbnail = author_info.try &.dig?("thumbnail", "thumbnails", 0, "url")
|
||||||
|
params["authorVerified"] = JSON::Any.new(author_info.try &.["badges"]? != nil)
|
||||||
params["authorThumbnail"] = JSON::Any.new(author_thumbnail.try &.as_s || "")
|
params["authorThumbnail"] = JSON::Any.new(author_thumbnail.try &.as_s || "")
|
||||||
|
|
||||||
params["subCountText"] = JSON::Any.new(author_info.try &.["subscriberCountText"]?
|
params["subCountText"] = JSON::Any.new(author_info.try &.["subscriberCountText"]?
|
||||||
|
@ -240,7 +240,7 @@ we're going to need to do it here in order to allow for translations.
|
|||||||
<% if !video.author_thumbnail.empty? %>
|
<% if !video.author_thumbnail.empty? %>
|
||||||
<img src="/ggpht<%= URI.parse(video.author_thumbnail).request_target %>">
|
<img src="/ggpht<%= URI.parse(video.author_thumbnail).request_target %>">
|
||||||
<% end %>
|
<% end %>
|
||||||
<span id="channel-name"><%= author %></span>
|
<span id="channel-name"><%= author %><% if video.author_verified %><i class="icon ion ion-md-checkmark-circle"></i><% end %></span>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user