API: Unescape search suggestions (#4218)

Previously, the suggestion were HTML encoded. This PR fixes that.
このコミットが含まれているのは:
Samantaz Fox 2024-02-12 22:03:33 +01:00
コミット bd5df3af5f
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: F42821059186176E
1個のファイルの変更5行の追加2行の削除

ファイルの表示

@ -32,11 +32,14 @@ module Invidious::Routes::API::V1::Search
begin
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
client.close
body = JSON.parse(response[5..-1]).as_a
body = JSON.parse(response[19..-2]).as_a
suggestions = body[1].as_a[0..-2]
JSON.build do |json|