mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add 'sort_by' to /api/v1/comments
This commit is contained in:
parent
f6615a490d
commit
5ef288b840
4 changed files with 143 additions and 19 deletions
|
@ -2691,11 +2691,14 @@ get "/api/v1/comments/:id" do |env|
|
|||
format = env.params.query["format"]?
|
||||
format ||= "json"
|
||||
|
||||
sort_by = env.params.query["sort_by"]?.try &.downcase
|
||||
sort_by ||= "top"
|
||||
|
||||
continuation = env.params.query["continuation"]?
|
||||
|
||||
if source == "youtube"
|
||||
begin
|
||||
comments = fetch_youtube_comments(id, PG_DB, continuation, proxies, format, locale, thin_mode, region)
|
||||
comments = fetch_youtube_comments(id, PG_DB, continuation, proxies, format, locale, thin_mode, region, sort_by: sort_by)
|
||||
rescue ex
|
||||
error_message = {"error" => ex.message}.to_json
|
||||
env.response.status_code = 500
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue