mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Add 'videoCount' to playlists in search
This commit is contained in:
parent
f80f4f2521
commit
1ab04638e3
2 changed files with 6 additions and 1 deletions
|
@ -2645,6 +2645,7 @@ get "/api/v1/channels/search/:ucid" do |env|
|
|||
json.field "authorId", item.ucid
|
||||
json.field "authorUrl", "/channel/#{item.ucid}"
|
||||
|
||||
json.field "videoCount", item.video_count
|
||||
json.field "videos" do
|
||||
json.array do
|
||||
item.videos.each do |video|
|
||||
|
@ -2765,6 +2766,7 @@ get "/api/v1/search" do |env|
|
|||
json.field "authorId", item.ucid
|
||||
json.field "authorUrl", "/channel/#{item.ucid}"
|
||||
|
||||
json.field "videoCount", item.video_count
|
||||
json.field "videos" do
|
||||
json.array do
|
||||
item.videos.each do |video|
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue