mirror of
https://github.com/iv-org/invidious.git
synced 2025-07-28 09:04:23 -04:00
Add a function to generate HTTP::Params from Filters
This commit is contained in:
parent
fb2a331f79
commit
6991d0851f
2 changed files with 133 additions and 0 deletions
|
@ -228,6 +228,25 @@ module Invidious::Search
|
|||
return filters
|
||||
end
|
||||
|
||||
def to_iv_params : HTTP::Params
|
||||
# Temporary variables
|
||||
raw_params = {} of String => Array(String)
|
||||
|
||||
raw_params["date"] = [@date.to_s.underscore] if !@date.none?
|
||||
raw_params["type"] = [@type.to_s.underscore] if !@type.all?
|
||||
raw_params["sort"] = [@sort.to_s.underscore] if !@sort.relevance?
|
||||
|
||||
if !@duration.none?
|
||||
raw_params["duration"] = [@duration.to_s.underscore]
|
||||
end
|
||||
|
||||
if !@features.none?
|
||||
raw_params["features"] = [Filters.format_features(@features)]
|
||||
end
|
||||
|
||||
return HTTP::Params.new(raw_params)
|
||||
end
|
||||
|
||||
# -------------------
|
||||
# Youtube params
|
||||
# -------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue