summaryrefslogtreecommitdiffstats
path: root/src/invidious.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/invidious.cr')
-rw-r--r--src/invidious.cr18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 2d566ac0..f0d7fbf1 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -731,6 +731,8 @@ get "/search" do |env|
sort = value
when "subscriptions"
subscriptions = value == "true"
+ else
+ operators.delete(operator)
end
end
@@ -1617,7 +1619,7 @@ get "/subscription_ajax" do |env|
}
post_url = "/subscription_ajax?#{action}=1&c=#{channel_id}"
- # Sync subscription with YouTube
+ # Sync subscriptions with YouTube
client.post(post_url, headers, form: post_req)
email = user.email
else
@@ -1953,7 +1955,7 @@ get "/feed/trending" do |env|
region ||= "US"
begin
- trending = fetch_trending(trending_type, proxies, region, locale)
+ trending, plid = fetch_trending(trending_type, proxies, region, locale)
rescue ex
error_message = "#{ex.message}"
next templated "error"
@@ -2778,12 +2780,12 @@ get "/api/v1/comments/:id" do |env|
format = env.params.query["format"]?
format ||= "json"
- sort_by = env.params.query["sort_by"]?.try &.downcase
- sort_by ||= "top"
-
continuation = env.params.query["continuation"]?
+ sort_by = env.params.query["sort_by"]?.try &.downcase
if source == "youtube"
+ sort_by ||= "top"
+
begin
comments = fetch_youtube_comments(id, PG_DB, continuation, proxies, format, locale, thin_mode, region, sort_by: sort_by)
rescue ex
@@ -2794,8 +2796,10 @@ get "/api/v1/comments/:id" do |env|
next comments
elsif source == "reddit"
+ sort_by ||= "confidence"
+
begin
- comments, reddit_thread = fetch_reddit_comments(id)
+ comments, reddit_thread = fetch_reddit_comments(id, sort_by: sort_by)
content_html = template_reddit_comments(comments, locale)
content_html = fill_links(content_html, "https", "www.reddit.com")
@@ -3201,7 +3205,7 @@ get "/api/v1/trending" do |env|
trending_type = env.params.query["type"]?
begin
- trending = fetch_trending(trending_type, proxies, region, locale)
+ trending, plid = fetch_trending(trending_type, proxies, region, locale)
rescue ex
error_message = {"error" => ex.message}.to_json
env.response.status_code = 500