From 4b8c6ea65203d72d3dc3bbb96bc35d695d3e4ee0 Mon Sep 17 00:00:00 2001 From: syeopite Date: Sun, 16 Jun 2024 14:15:05 -0700 Subject: [PATCH] Search API: Fix named arg syntax to make_client --- src/invidious/routes/api/v1/search.cr | 2 +- src/invidious/yt_backend/connection_pool.cr | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/invidious/routes/api/v1/search.cr b/src/invidious/routes/api/v1/search.cr index 6785ef73..59a30745 100644 --- a/src/invidious/routes/api/v1/search.cr +++ b/src/invidious/routes/api/v1/search.cr @@ -31,7 +31,7 @@ module Invidious::Routes::API::V1::Search query = env.params.query["q"]? || "" begin - client = make_client(URI.parse("https://suggestqueries-clients6.youtube.com"), force_youtube_headers = true) + client = make_client(URI.parse("https://suggestqueries-clients6.youtube.com"), force_youtube_headers: true) url = "/complete/search?client=youtube&hl=en&gl=#{region}&q=#{URI.encode_www_form(query)}&gs_ri=youtube&ds=yt" response = client.get(url).body diff --git a/src/invidious/yt_backend/connection_pool.cr b/src/invidious/yt_backend/connection_pool.cr index 0b9dc2c0..b147231b 100644 --- a/src/invidious/yt_backend/connection_pool.cr +++ b/src/invidious/yt_backend/connection_pool.cr @@ -49,7 +49,7 @@ struct YoutubeConnectionPool end end -def make_client(url : URI, region = nil, force_resolve : Bool = false, force_youtube_header : Bool = false) +def make_client(url : URI, region = nil, force_resolve : Bool = false, force_youtube_headers : Bool = false) client = HTTP::Client.new(url) # Force the usage of a specific configured IP Family @@ -57,7 +57,7 @@ def make_client(url : URI, region = nil, force_resolve : Bool = false, force_you client.family = CONFIG.force_resolve end - client.before_request { |r| add_yt_headers(r) } if url.host == "www.youtube.com" || force_youtube_header + client.before_request { |r| add_yt_headers(r) } if url.host == "www.youtube.com" || force_youtube_headers client.read_timeout = 10.seconds client.connect_timeout = 10.seconds