checking the status code returned by youtube

This commit is contained in:
Emilien 2024-11-02 23:53:51 +01:00
parent 2e3a7ad044
commit a11b59bcf7

View File

@ -638,6 +638,10 @@ module YoutubeAPI
# Send the POST request
body = YT_POOL.client() do |client|
client.post(url, headers: headers, body: data.to_json) do |response|
if response.status_code != 200
raise InfoException.new("Error: non 200 status code. Youtube API returned \
status code #{response.status_code}")
end
self._decompress(response.body_io, response.headers["Content-Encoding"]?)
end
end