Skip to content

Commit

Permalink
checking the status code returned by youtube (iv-org#5052)
Browse files Browse the repository at this point in the history
* checking the status code returned by youtube

* add documentation link

* Update src/invidious/yt_backend/youtube_api.cr

Co-authored-by: syeopite <[email protected]>

---------

Co-authored-by: syeopite <[email protected]>
  • Loading branch information
2 people authored and acheong08 committed Nov 8, 2024
1 parent 6f0f3ca commit b587b28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/invidious/yt_backend/youtube_api.cr
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ 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}. 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"]?)
end
end
Expand Down

0 comments on commit b587b28

Please sign in to comment.