mirror of
https://github.com/iv-org/invidious
synced 2024-11-28 05:53:28 +01:00
Fix provided author for '/videos' endpoint
This commit is contained in:
parent
501b523680
commit
2df97cd2f5
@ -2908,7 +2908,7 @@ get "/channel/:ucid" do |env|
|
||||
sort_options = {"newest", "oldest", "popular"}
|
||||
sort_by ||= "newest"
|
||||
|
||||
items, count = get_60_videos(channel.ucid, page, channel.auto_generated, sort_by)
|
||||
items, count = get_60_videos(channel.ucid, channel.author, page, channel.auto_generated, sort_by)
|
||||
items.select! { |item| !item.paid }
|
||||
|
||||
env.set "search", "channel:#{channel.ucid} "
|
||||
@ -3544,7 +3544,7 @@ get "/api/v1/channels/:ucid" do |env|
|
||||
count = 0
|
||||
else
|
||||
begin
|
||||
videos, count = get_60_videos(channel.ucid, page, channel.auto_generated, sort_by)
|
||||
videos, count = get_60_videos(channel.ucid, channel.author,page, channel.auto_generated, sort_by)
|
||||
rescue ex
|
||||
error_message = {"error" => ex.message}.to_json
|
||||
env.response.status_code = 500
|
||||
@ -3669,7 +3669,7 @@ end
|
||||
end
|
||||
|
||||
begin
|
||||
videos, count = get_60_videos(channel.ucid, page, channel.auto_generated, sort_by)
|
||||
videos, count = get_60_videos(channel.ucid, channel.author, page, channel.auto_generated, sort_by)
|
||||
rescue ex
|
||||
error_message = {"error" => ex.message}.to_json
|
||||
env.response.status_code = 500
|
||||
@ -3806,11 +3806,8 @@ get "/api/v1/search" do |env|
|
||||
search_params = produce_search_params(sort_by, date, content_type, duration, features)
|
||||
rescue ex
|
||||
env.response.status_code = 400
|
||||
next JSON.build do |json|
|
||||
json.object do
|
||||
json.field "error", ex.message
|
||||
end
|
||||
end
|
||||
error_message = {"error" => ex.message}.to_json
|
||||
next error_message
|
||||
end
|
||||
|
||||
count, search_results = search(query, page, search_params, region).as(Tuple)
|
||||
|
@ -729,7 +729,7 @@ def get_about_info(ucid, locale)
|
||||
)
|
||||
end
|
||||
|
||||
def get_60_videos(ucid, page, auto_generated, sort_by = "newest")
|
||||
def get_60_videos(ucid, author, page, auto_generated, sort_by = "newest")
|
||||
count = 0
|
||||
videos = [] of SearchVideo
|
||||
|
||||
@ -751,7 +751,7 @@ def get_60_videos(ucid, page, auto_generated, sort_by = "newest")
|
||||
if auto_generated
|
||||
videos += extract_videos(nodeset)
|
||||
else
|
||||
videos += extract_videos(nodeset, ucid)
|
||||
videos += extract_videos(nodeset, ucid, author)
|
||||
end
|
||||
else
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user