mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-22 16:19:53 +05:30
Unescape search suggestions
This commit is contained in:
parent
9e8baa3539
commit
6488794218
@ -32,11 +32,13 @@ module Invidious::Routes::API::V1::Search
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
client = HTTP::Client.new("suggestqueries-clients6.youtube.com")
|
client = HTTP::Client.new("suggestqueries-clients6.youtube.com")
|
||||||
url = "/complete/search?client=youtube&hl=en&gl=#{region}&q=#{URI.encode_www_form(query)}&xssi=t&gs_ri=youtube&ds=yt"
|
client.before_request { |r| add_yt_headers(r) }
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
body = JSON.parse(response[5..-1]).as_a
|
body = JSON.parse(response[19..-2]).as_a
|
||||||
suggestions = body[1].as_a[0..-2]
|
suggestions = body[1].as_a[0..-2]
|
||||||
|
|
||||||
JSON.build do |json|
|
JSON.build do |json|
|
||||||
|
Loading…
Reference in New Issue
Block a user