mirror of
https://github.com/iv-org/invidious.git
synced 2024-11-27 00:10:25 +00:00
checking the status code returned by youtube (#5052)
* checking the status code returned by youtube * add documentation link * Update src/invidious/yt_backend/youtube_api.cr Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com> --------- Co-authored-by: syeopite <70992037+syeopite@users.noreply.github.com>
This commit is contained in:
parent
2e3a7ad044
commit
ac6e796c73
@ -638,6 +638,11 @@ module YoutubeAPI
|
|||||||
# Send the POST request
|
# Send the POST request
|
||||||
body = YT_POOL.client() do |client|
|
body = YT_POOL.client() do |client|
|
||||||
client.post(url, headers: headers, body: data.to_json) do |response|
|
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}. See <a href=\"https://docs.invidious.io/youtube-errors-explained/\"> \
|
||||||
|
https://docs.invidious.io/youtube-errors-explained/</a> for troubleshooting.")
|
||||||
|
end
|
||||||
self._decompress(response.body_io, response.headers["Content-Encoding"]?)
|
self._decompress(response.body_io, response.headers["Content-Encoding"]?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user