Skip to content

Commit

Permalink
API: Add "sort_by" parameter to channels/shorts endpoint (#5071)
Browse files Browse the repository at this point in the history
Small follow up to PR 5059

No related issue
  • Loading branch information
SamantazFox committed Nov 10, 2024
2 parents 7092bb8 + d2123b4 commit d42561d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/invidious/routes/api/v1/channels.cr
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ module Invidious::Routes::API::V1::Channels
get_channel()

# Retrieve continuation from URL parameters
sort_by = env.params.query["sort_by"]?.try &.downcase || "newest"
continuation = env.params.query["continuation"]?

if channel.is_age_gated
Expand All @@ -211,7 +212,7 @@ module Invidious::Routes::API::V1::Channels
else
begin
videos, next_continuation = Channel::Tabs.get_shorts(
channel, continuation: continuation
channel, continuation: continuation, sort_by: sort_by
)
rescue ex
return error_json(500, ex)
Expand Down

0 comments on commit d42561d

Please sign in to comment.