summaryrefslogtreecommitdiffstats
path: root/src/invidious.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/invidious.cr')
-rw-r--r--src/invidious.cr10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 147fe935..a4f20bc4 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -87,6 +87,7 @@ LOCALES = {
"nb_NO" => load_locale("nb_NO"),
"nl" => load_locale("nl"),
"pl" => load_locale("pl"),
+ "ro" => load_locale("ro"),
"ru" => load_locale("ru"),
"tr" => load_locale("tr"),
"uk" => load_locale("uk"),
@@ -3852,7 +3853,7 @@ get "/api/v1/captions/:id" do |env|
caption = caption[0]
end
- url = "#{caption.baseUrl}&tlang=#{tlang}"
+ url = URI.parse("#{caption.baseUrl}&tlang=#{tlang}").full_path
# Auto-generated captions often have cues that aren't aligned properly with the video,
# as well as some other markup that makes it cumbersome, so we try to fix that here
@@ -4523,9 +4524,10 @@ 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