mirror of
https://github.com/iv-org/invidious.git
synced 2026-08-16 21:10:53 -05:00
Fix inconsistent page param behavior for YouTube playlists in APIv1
This commit is contained in:
parent
8fde720f94
commit
4ec99d7898
@ -33,10 +33,6 @@ module Invidious::Routes::API::V1::Misc
|
|||||||
env.response.content_type = "application/json"
|
env.response.content_type = "application/json"
|
||||||
plid = env.params.url["plid"]
|
plid = env.params.url["plid"]
|
||||||
|
|
||||||
offset = env.params.query["index"]?.try &.to_i?
|
|
||||||
offset ||= env.params.query["page"]?.try &.to_i?.try { |page| (page - 1) * 100 }
|
|
||||||
offset ||= 0
|
|
||||||
|
|
||||||
video_id = env.params.query["continuation"]?
|
video_id = env.params.query["continuation"]?
|
||||||
|
|
||||||
format = env.params.query["format"]?
|
format = env.params.query["format"]?
|
||||||
@ -57,6 +53,19 @@ module Invidious::Routes::API::V1::Misc
|
|||||||
return error_json(404, "Playlist does not exist.")
|
return error_json(404, "Playlist does not exist.")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
offset = env.params.query["index"]?.try &.to_i?
|
||||||
|
if offset.nil?
|
||||||
|
page = env.params.query["page"]?.try &.to_i?
|
||||||
|
if page
|
||||||
|
if playlist.is_a? InvidiousPlaylist
|
||||||
|
offset = (page - 1) * 100
|
||||||
|
else
|
||||||
|
offset = (page - 1) * 200
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
offset ||= 0
|
||||||
|
|
||||||
user = env.get?("user").try &.as(User)
|
user = env.get?("user").try &.as(User)
|
||||||
if !playlist || playlist.privacy.private? && playlist.author != user.try &.email
|
if !playlist || playlist.privacy.private? && playlist.author != user.try &.email
|
||||||
return error_json(404, "Playlist does not exist.")
|
return error_json(404, "Playlist does not exist.")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user