mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-20 18:08:54 +00:00
Add #to_http_params method to Query (Fixes #3148)
This commit is contained in:
@@ -57,7 +57,7 @@ module Invidious::Search
|
||||
# Get the page number (also common to all search types)
|
||||
@page = params["page"]?.try &.to_i? || 1
|
||||
|
||||
# Stop here is raw query in empty
|
||||
# Stop here if raw query is empty
|
||||
# NOTE: maybe raise in the future?
|
||||
return if self.empty_raw_query?
|
||||
|
||||
@@ -127,6 +127,16 @@ module Invidious::Search
|
||||
return items
|
||||
end
|
||||
|
||||
# Return the HTTP::Params corresponding to this Query (invidious format)
|
||||
def to_http_params : HTTP::Params
|
||||
params = @filters.to_iv_params
|
||||
|
||||
params["q"] = @query
|
||||
params["channel"] = @channel if !@channel.empty?
|
||||
|
||||
return params
|
||||
end
|
||||
|
||||
# TODO: clean code
|
||||
private def unnest_items(all_items) : Array(SearchItem)
|
||||
items = [] of SearchItem
|
||||
|
||||
Reference in New Issue
Block a user