diff --git a/src/invidious/routes/search.cr b/src/invidious/routes/search.cr index 513904b8..d98c8926 100644 --- a/src/invidious/routes/search.cr +++ b/src/invidious/routes/search.cr @@ -52,17 +52,11 @@ class Invidious::Routes::Search < Invidious::Routes::BaseRoute user = env.get? "user" begin - search_query, count, videos, operators = process_search_query(query, page, user, region: region) + search_query, count, items, operators = process_search_query(env.params.query, query, page, user, region: nil) rescue ex return error_template(500, ex) end - operator_hash = {} of String => String - operators.each do |operator| - key, value = operator.downcase.split(":") - operator_hash[key] = value - end - env.set "search", query templated "search" end diff --git a/src/invidious/search.cr b/src/invidious/search.cr index b2b0eee0..b26a4158 100644 --- a/src/invidious/search.cr +++ b/src/invidious/search.cr @@ -182,7 +182,7 @@ def process_search_query(url_params, query, page, user, region) sort = "relevance" subscriptions = nil - # operators = url_params.split(" ").select { |a| a.match(/\w+:[\,]+/) } + # operators = query.split(" ").select { |a| a.match(/\w+:[\w,]+/) } url_params.each do |operator| key, value = operator @@ -237,14 +237,14 @@ def process_search_query(url_params, query, page, user, region) items.each do |i| if i.is_a? Category i.contents.each do |cate_items| - if cate_items.is_a? (SearchVideo | SearchPlaylist | SearchChannel) + if cate_items.is_a?(SearchVideo | SearchPlaylist | SearchChannel) extracted_items << cate_items end end else extracted_items << i end - end + end - {search_query, count, extracted_items, url_params} + {search_query, count, items, url_params} end diff --git a/src/invidious/views/search.ecr b/src/invidious/views/search.ecr index 6afbee95..896ceda6 100644 --- a/src/invidious/views/search.ecr +++ b/src/invidious/views/search.ecr @@ -15,123 +15,125 @@