Add 'videoCount' to playlists in search

This commit is contained in:
Omar Roth
2018-09-22 11:14:57 -05:00
parent f80f4f2521
commit 1ab04638e3
2 changed files with 6 additions and 1 deletions

View File

@@ -238,7 +238,10 @@ def extract_items(nodeset, ucid = nil)
when .includes? "yt-lockup-playlist"
plid = HTTP::Params.parse(URI.parse(id).query.not_nil!)["list"]
anchor = node.xpath_node(%q(.//ul[@class="yt-lockup-meta-info"]/li/a))
anchor = node.xpath_node(%q(.//div[contains(@class, "yt-lockup-meta")]/a))
if !anchor
anchor = node.xpath_node(%q(.//ul[@class="yt-lockup-meta-info"]/li/a))
end
if anchor
video_count = anchor.content.match(/View full playlist \((?<count>\d+)/).try &.["count"].to_i?
end