forked from midou/invidious
Hide video count for auto-generated channels
This commit is contained in:
parent
34c43b8349
commit
50d793e49b
@ -424,15 +424,15 @@ def extract_items(nodeset, ucid = nil, author_name = nil)
|
|||||||
subscriber_count ||= 0
|
subscriber_count ||= 0
|
||||||
|
|
||||||
video_count = node.xpath_node(%q(.//ul[@class="yt-lockup-meta-info"]/li)).try &.content.split(" ")[0].gsub(/\D/, "").to_i?
|
video_count = node.xpath_node(%q(.//ul[@class="yt-lockup-meta-info"]/li)).try &.content.split(" ")[0].gsub(/\D/, "").to_i?
|
||||||
video_count ||= 0
|
|
||||||
|
|
||||||
items << SearchChannel.new(
|
items << SearchChannel.new(
|
||||||
author: author,
|
author: author,
|
||||||
ucid: ucid,
|
ucid: ucid,
|
||||||
author_thumbnail: author_thumbnail,
|
author_thumbnail: author_thumbnail,
|
||||||
subscriber_count: subscriber_count,
|
subscriber_count: subscriber_count,
|
||||||
video_count: video_count,
|
video_count: video_count || 0,
|
||||||
description_html: description_html
|
description_html: description_html,
|
||||||
|
auto_generated: video_count ? false : true,
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
id = id.lchop("/watch?v=")
|
id = id.lchop("/watch?v=")
|
||||||
|
@ -185,8 +185,10 @@ struct SearchChannel
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
json.field "autoGenerated", self.auto_generated
|
||||||
json.field "subCount", self.subscriber_count
|
json.field "subCount", self.subscriber_count
|
||||||
json.field "videoCount", self.video_count
|
json.field "videoCount", self.video_count
|
||||||
|
|
||||||
json.field "description", html_to_content(self.description_html)
|
json.field "description", html_to_content(self.description_html)
|
||||||
json.field "descriptionHtml", self.description_html
|
json.field "descriptionHtml", self.description_html
|
||||||
end
|
end
|
||||||
@ -209,6 +211,7 @@ struct SearchChannel
|
|||||||
subscriber_count: Int32,
|
subscriber_count: Int32,
|
||||||
video_count: Int32,
|
video_count: Int32,
|
||||||
description_html: String,
|
description_html: String,
|
||||||
|
auto_generated: Bool,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<p><%= item.author %></p>
|
<p><%= item.author %></p>
|
||||||
</a>
|
</a>
|
||||||
<p><%= translate(locale, "`x` subscribers", number_with_separator(item.subscriber_count)) %></p>
|
<p><%= translate(locale, "`x` subscribers", number_with_separator(item.subscriber_count)) %></p>
|
||||||
<p><%= translate(locale, "`x` videos", number_with_separator(item.video_count)) %></p>
|
<% if !item.auto_generated %><p><%= translate(locale, "`x` videos", number_with_separator(item.video_count)) %></p><% end %>
|
||||||
<h5><%= item.description_html %></h5>
|
<h5><%= item.description_html %></h5>
|
||||||
<% when SearchPlaylist %>
|
<% when SearchPlaylist %>
|
||||||
<% if item.id.starts_with? "RD" %>
|
<% if item.id.starts_with? "RD" %>
|
||||||
|
Loading…
Reference in New Issue
Block a user