mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-25 06:57:22 +00:00
Search API: Fix named arg syntax to make_client
This commit is contained in:
parent
ee89db49ba
commit
bd48af825c
@ -31,7 +31,7 @@ module Invidious::Routes::API::V1::Search
|
|||||||
query = env.params.query["q"]? || ""
|
query = env.params.query["q"]? || ""
|
||||||
|
|
||||||
begin
|
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"
|
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
|
response = client.get(url).body
|
||||||
|
@ -49,7 +49,7 @@ struct YoutubeConnectionPool
|
|||||||
end
|
end
|
||||||
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)
|
client = HTTP::Client.new(url)
|
||||||
|
|
||||||
# Force the usage of a specific configured IP Family
|
# 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
|
client.family = CONFIG.force_resolve
|
||||||
end
|
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.read_timeout = 10.seconds
|
||||||
client.connect_timeout = 10.seconds
|
client.connect_timeout = 10.seconds
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user