Skip to content

Commit

Permalink
Search API: Fix named arg syntax to make_client
Browse files Browse the repository at this point in the history
  • Loading branch information
syeopite committed Jun 16, 2024
1 parent 41f7f70 commit 4b8c6ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/invidious/routes/api/v1/search.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/invidious/yt_backend/connection_pool.cr
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ 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
if force_resolve
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

Expand Down

0 comments on commit 4b8c6ea

Please sign in to comment.