Hide video count for auto-generated channels

pull/752/head
Omar Roth 5 years ago
parent 34c43b8349
commit 50d793e49b
No known key found for this signature in database
GPG Key ID: B8254FB7EC3D37F2

@ -424,15 +424,15 @@ def extract_items(nodeset, ucid = nil, author_name = nil)
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 ||= 0
items << SearchChannel.new(
author: author,
ucid: ucid,
author_thumbnail: author_thumbnail,
subscriber_count: subscriber_count,
video_count: video_count,
description_html: description_html
video_count: video_count || 0,
description_html: description_html,
auto_generated: video_count ? false : true,
)
else
id = id.lchop("/watch?v=")

@ -185,8 +185,10 @@ struct SearchChannel
end
end
json.field "autoGenerated", self.auto_generated
json.field "subCount", self.subscriber_count
json.field "videoCount", self.video_count
json.field "description", html_to_content(self.description_html)
json.field "descriptionHtml", self.description_html
end
@ -209,6 +211,7 @@ struct SearchChannel
subscriber_count: Int32,
video_count: Int32,
description_html: String,
auto_generated: Bool,
})
end

@ -11,7 +11,7 @@
<p><%= item.author %></p>
</a>
<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>
<% when SearchPlaylist %>
<% if item.id.starts_with? "RD" %>

Loading…
Cancel
Save