mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-21 05:34:22 -05:00
Add 'lengthSeconds' to /channels/:ucid/videos
This commit is contained in:
parent
7060c67328
commit
573e909785
@ -1145,6 +1145,11 @@ get "/api/v1/channels/:ucid/videos" do |env|
|
|||||||
published = published.content
|
published = published.content
|
||||||
published = decode_date(published)
|
published = decode_date(published)
|
||||||
|
|
||||||
|
length_seconds = item.xpath_node(%q(.//span[@class="video-time"]/span)).not_nil!.content
|
||||||
|
length_seconds = length_seconds.split(":").map { |a| a.to_i }
|
||||||
|
length_seconds = [0] * (3 - length_seconds.size) + length_seconds
|
||||||
|
length_seconds = Time::Span.new(length_seconds[0], length_seconds[1], length_seconds[2])
|
||||||
|
|
||||||
json.object do
|
json.object do
|
||||||
json.field "title", title
|
json.field "title", title
|
||||||
json.field "videoId", video_id
|
json.field "videoId", video_id
|
||||||
@ -1172,6 +1177,7 @@ get "/api/v1/channels/:ucid/videos" do |env|
|
|||||||
|
|
||||||
json.field "viewCount", view_count
|
json.field "viewCount", view_count
|
||||||
json.field "published", published.epoch
|
json.field "published", published.epoch
|
||||||
|
json.field "lengthSeconds", length_seconds.total_seconds.to_i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user