mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-21 10:28:50 +00:00
search functions: Don't return result count
This is useless, as the items count can be directly acessed using the '.size' method, so use that instead when needed.
This commit is contained in:
@@ -254,7 +254,7 @@ module Invidious::Routes::API::V1::Channels
|
||||
page = env.params.query["page"]?.try &.to_i?
|
||||
page ||= 1
|
||||
|
||||
count, search_results = channel_search(query, page, ucid)
|
||||
search_results = channel_search(query, page, ucid)
|
||||
JSON.build do |json|
|
||||
json.array do
|
||||
search_results.each do |item|
|
||||
|
||||
@@ -32,7 +32,7 @@ module Invidious::Routes::API::V1::Search
|
||||
return error_json(400, ex)
|
||||
end
|
||||
|
||||
count, search_results = search(query, search_params, region).as(Tuple)
|
||||
search_results = search(query, search_params, region)
|
||||
JSON.build do |json|
|
||||
json.array do
|
||||
search_results.each do |item|
|
||||
|
||||
@@ -247,15 +247,13 @@ module Invidious::Routes::Playlists
|
||||
query = env.params.query["q"]?
|
||||
if query
|
||||
begin
|
||||
search_query, count, items, operators = process_search_query(query, page, user, region: nil)
|
||||
search_query, items, operators = process_search_query(query, page, user, region: nil)
|
||||
videos = items.select(SearchVideo).map(&.as(SearchVideo))
|
||||
rescue ex
|
||||
videos = [] of SearchVideo
|
||||
count = 0
|
||||
end
|
||||
else
|
||||
videos = [] of SearchVideo
|
||||
count = 0
|
||||
end
|
||||
|
||||
env.set "add_playlist_items", plid
|
||||
|
||||
@@ -54,7 +54,7 @@ module Invidious::Routes::Search
|
||||
user = env.get? "user"
|
||||
|
||||
begin
|
||||
search_query, count, videos, operators = process_search_query(query, page, user, region: region)
|
||||
search_query, videos, operators = process_search_query(query, page, user, region: region)
|
||||
rescue ex : ChannelSearchException
|
||||
return error_template(404, "Unable to find channel with id of '#{HTML.escape(ex.channel)}'. Are you sure that's an actual channel id? It should look like 'UC4QobU6STFB0P71PMvOGN5A'.")
|
||||
rescue ex
|
||||
|
||||
Reference in New Issue
Block a user