diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-09-17 16:38:18 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-09-17 16:56:28 -0500 |
| commit | 296771809a73f6dec1fbe86c58106f06097299c8 (patch) | |
| tree | e1587a4191448b3f59405b1cbfc2dc116c231021 /src/invidious.cr | |
| parent | 83ba4e2a4c1cb974d20499867b0fd445071ea07e (diff) | |
| download | invidious-296771809a73f6dec1fbe86c58106f06097299c8.tar.gz invidious-296771809a73f6dec1fbe86c58106f06097299c8.tar.bz2 invidious-296771809a73f6dec1fbe86c58106f06097299c8.zip | |
Refactor protocol buffers
Diffstat (limited to 'src/invidious.cr')
| -rw-r--r-- | src/invidious.cr | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 38c3e018..3286f3ae 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -455,7 +455,7 @@ get "/search" do |env| date = value when "duration" duration = value - when "features" + when "feature", "features" features = value.split(",") when "sort" sort = value @@ -478,8 +478,14 @@ get "/search" do |env| ) v_search WHERE v_search.document @@ plainto_tsquery($1) LIMIT 20 OFFSET $2;", [search_query, (page - 1) * 20] + ucids, as: ChannelVideo) count = videos.size else - search_params = build_search_params(sort: sort, date: date, content_type: "video", - duration: duration, features: features) + begin + search_params = produce_search_params(sort: sort, date: date, content_type: "video", + duration: duration, features: features) + rescue ex + error_message = ex.message + next templated "error" + end + count, videos = search(search_query, page, search_params).as(Tuple) end @@ -2643,7 +2649,7 @@ get "/api/v1/search" do |env| env.response.content_type = "application/json" begin - search_params = build_search_params(sort_by, date, content_type, duration, features) + search_params = produce_search_params(sort_by, date, content_type, duration, features) rescue ex next JSON.build do |json| json.object do |
