mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-14 09:16:00 +05:30
Add 'videoCount' to playlists in search
This commit is contained in:
parent
f80f4f2521
commit
1ab04638e3
@ -2645,6 +2645,7 @@ get "/api/v1/channels/search/:ucid" do |env|
|
|||||||
json.field "authorId", item.ucid
|
json.field "authorId", item.ucid
|
||||||
json.field "authorUrl", "/channel/#{item.ucid}"
|
json.field "authorUrl", "/channel/#{item.ucid}"
|
||||||
|
|
||||||
|
json.field "videoCount", item.video_count
|
||||||
json.field "videos" do
|
json.field "videos" do
|
||||||
json.array do
|
json.array do
|
||||||
item.videos.each do |video|
|
item.videos.each do |video|
|
||||||
@ -2765,6 +2766,7 @@ get "/api/v1/search" do |env|
|
|||||||
json.field "authorId", item.ucid
|
json.field "authorId", item.ucid
|
||||||
json.field "authorUrl", "/channel/#{item.ucid}"
|
json.field "authorUrl", "/channel/#{item.ucid}"
|
||||||
|
|
||||||
|
json.field "videoCount", item.video_count
|
||||||
json.field "videos" do
|
json.field "videos" do
|
||||||
json.array do
|
json.array do
|
||||||
item.videos.each do |video|
|
item.videos.each do |video|
|
||||||
|
@ -238,7 +238,10 @@ def extract_items(nodeset, ucid = nil)
|
|||||||
when .includes? "yt-lockup-playlist"
|
when .includes? "yt-lockup-playlist"
|
||||||
plid = HTTP::Params.parse(URI.parse(id).query.not_nil!)["list"]
|
plid = HTTP::Params.parse(URI.parse(id).query.not_nil!)["list"]
|
||||||
|
|
||||||
|
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))
|
anchor = node.xpath_node(%q(.//ul[@class="yt-lockup-meta-info"]/li/a))
|
||||||
|
end
|
||||||
if anchor
|
if anchor
|
||||||
video_count = anchor.content.match(/View full playlist \((?<count>\d+)/).try &.["count"].to_i?
|
video_count = anchor.content.match(/View full playlist \((?<count>\d+)/).try &.["count"].to_i?
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user