fix Shadowing outer local variable response

This commit is contained in:
Emilien Devos 2024-10-20 23:53:08 +02:00 committed by Emilien
parent 73c84baf9f
commit 1954463371

View File

@ -648,11 +648,11 @@ module YoutubeAPI
puts "invidious companion section" puts "invidious companion section"
puts invidious_companion_urls[Random.rand(invidious_companion_urls.size)] puts invidious_companion_urls[Random.rand(invidious_companion_urls.size)]
begin begin
response = make_client(URI.parse(invidious_companion_urls[Random.rand(invidious_companion_urls.size)]), invidious_companion_response = make_client(URI.parse(invidious_companion_urls[Random.rand(invidious_companion_urls.size)]),
&.post(endpoint, headers: headers, body: data.to_json)) &.post(endpoint, headers: headers, body: data.to_json))
body = response.body body = invidious_companion_response.body
if (response.status_code != 200) if (invidious_companion_response.status_code != 200)
raise Exception.new("status code: " + response.status_code.to_s + " and body: " + body) raise Exception.new("status code: " + invidious_companion_response.status_code.to_s + " and body: " + body)
end end
rescue ex rescue ex
raise InfoException.new("Error while communicating with Invidious companion: " + (ex.message || "no extra info found")) raise InfoException.new("Error while communicating with Invidious companion: " + (ex.message || "no extra info found"))