mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add support for force_resolve to QUIC client
This commit is contained in:
parent
3fea1976c8
commit
a017574f74
3 changed files with 14 additions and 9 deletions
|
@ -4523,10 +4523,11 @@ get "/api/v1/search/suggestions" do |env|
|
|||
query ||= ""
|
||||
|
||||
begin
|
||||
response = QUIC::Client.get(
|
||||
"https://suggestqueries.google.com/complete/search?hl=en&gl=#{region}&client=youtube&ds=yt&q=#{URI.encode_www_form(query)}&callback=suggestCallback"
|
||||
).body
|
||||
|
||||
client = QUIC::Client.new("suggestqueries.google.com")
|
||||
client.family = CONFIG.force_resolve || Socket::Family::INET
|
||||
client.family = Socket::Family::INET if client.family == Socket::Family::UNSPEC
|
||||
response = client.get("/complete/search?hl=en&gl=#{region}&client=youtube&ds=yt&q=#{URI.encode_www_form(query)}&callback=suggestCallback").body
|
||||
|
||||
body = response[35..-2]
|
||||
body = JSON.parse(body).as_a
|
||||
suggestions = body[1].as_a[0..-2]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue