Merge f3d39d1fb4f49b8345a7f609b837d74f2255d896 into c88230067b7a3abbb569ac0938bf8d897c8340be

This commit is contained in:
Radostina (Radi for short) 2026-09-19 06:48:37 +00:00 committed by GitHub
commit 849e735a3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 45 additions and 5 deletions

View File

@ -23,10 +23,41 @@ module Invidious::Videos::Parser
channel_info = (related["shortBylineText"]? || related["longBylineText"]?) channel_info = (related["shortBylineText"]? || related["longBylineText"]?)
.try &.dig?("runs", 0) .try &.dig?("runs", 0)
if collab_text = channel_info.try &.dig?("navigationEndpoint", "showDialogCommand", "panelLoadingStrategy", "inlineContent", "dialogViewModel", "header", "dialogHeaderViewModel", "headline", "content")
if collab_text == "Collaborators"
collab = true
else
collab = false
end
else
collab = false
end
if collab == false
author = channel_info.try &.dig?("text") author = channel_info.try &.dig?("text")
author_verified = has_verified_badge?(related["ownerBadges"]?).to_s author_verified = has_verified_badge?(related["ownerBadges"]?).to_s
ucid = channel_info.try { |ci| HelperExtractors.get_browse_id(ci) } ucid = channel_info.try { |ci| HelperExtractors.get_browse_id(ci) }
else
raw_author_list = channel_info.try &.dig?("navigationEndpoint", "showDialogCommand", "panelLoadingStrategy", "inlineContent", "dialogViewModel", "customContent", "listViewModel", "listItems").try(&.as_a?)
author_list = Array(JSON::Any).new
if raw_author_list
raw_author_list.each do |raw_author|
username = raw_author.dig?("listItemViewModel", "title", "content").try(&.as_s?)
collab_ucid = raw_author.dig?("listItemViewModel", "rendererContext", "commandContext", "onTap", "innertubeCommand", "browseEndpoint", "browseId").try(&.as_s?)
attachment_runs = raw_author.dig?("listItemViewModel", "title", "attachmentRuns").try(&.as_a?)
collab_author_verified = false
if attachment_runs
collab_author_verified = attachment_runs.any? do |run|
run.dig?("element", "type", "imageType", "image", "sources", 0, "clientResource", "imageName").try(&.as_s?) == "CHECK_CIRCLE_FILLED"
end
end
if username && collab_ucid && collab_author_verified != nil
author_list << JSON::Any.new({"username" => JSON::Any.new(username), "ucid" => JSON::Any.new(collab_ucid), "author_verified" => JSON::Any.new(collab_author_verified.to_s)})
end
end
end
end
short_view_count = related.try do |r| short_view_count = related.try do |r|
HelperExtractors.get_short_view_count(r).to_s HelperExtractors.get_short_view_count(r).to_s
@ -48,9 +79,10 @@ module Invidious::Videos::Parser
"title" => related["title"]["simpleText"], "title" => related["title"]["simpleText"],
"author" => author || JSON::Any.new(""), "author" => author || JSON::Any.new(""),
"ucid" => JSON::Any.new(ucid || ""), "ucid" => JSON::Any.new(ucid || ""),
"author_list" => JSON::Any.new(author_list.to_json || "[]"),
"length_seconds" => JSON::Any.new(length || "0"), "length_seconds" => JSON::Any.new(length || "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(author_verified), "author_verified" => JSON::Any.new(author_verified || ""),
"published" => JSON::Any.new(published || ""), "published" => JSON::Any.new(published || ""),
} }
end end

View File

@ -391,8 +391,16 @@ we're going to need to do it here in order to allow for translations.
<div class="pure-u-14-24"> <div class="pure-u-14-24">
<% if !rv["ucid"].empty? %> <% if !rv["ucid"].empty? %>
<b style="width:100%"><a href="/channel/<%= rv["ucid"] %>"><%= rv["author"]? %><% if rv["author_verified"]? == "true" %>&nbsp;<i class="icon ion ion-md-checkmark-circle"></i><% end %></a></b> <b style="width:100%"><a href="/channel/<%= rv["ucid"] %>"><%= rv["author"]? %><% if rv["author_verified"]? == "true" %>&nbsp;<i class="icon ion ion-md-checkmark-circle"></i><% end %></a></b>
<% else %> <% elsif rv["ucid"].empty? && !rv["author"].empty? %>
<b style="width:100%"><%= rv["author"]? %><% if rv["author_verified"]? == "true" %>&nbsp;<i class="icon ion ion-md-checkmark-circle"></i><% end %></b> <b style="width:100%"><%= rv["author"]? %><% if rv["author_verified"]? == "true" %>&nbsp;<i class="icon ion ion-md-checkmark-circle"></i><% end %></b>
<% else %>
<b style="width:100%">
<% if author_list = JSON.parse(rv["author_list"]).as_a? %>
<% author_list.each_with_index do |author_item, index| %>
<a href="/channel/<%= author_item["ucid"].as_s? || "" %>"><%= author_item["username"].as_s? || "" %><% if author_item["author_verified"]? == "true" %>&nbsp;<i class="icon ion ion-md-checkmark-circle"></i><% end %></a><% if index < author_list.size - 1 %>, <% end %>
<% end %>
<% end %>
</b>
<% end %> <% end %>
</div> </div>