Multiple youtube_api.cr helper fixes

Add documentation
Bump web client version string
Add charset=UTF-8 to the 'content-type' header
Parse JSON and return it as a Hash
Handle API error messages
This commit is contained in:
Samantaz Fox
2021-04-01 02:36:43 +00:00
parent 8bbb016fa4
commit 43bd331e48
4 changed files with 36 additions and 38 deletions

View File

@@ -451,7 +451,7 @@ def get_playlist_videos(db, playlist, offset, locale = nil, continuation = nil)
offset = (offset / 100).to_i64 * 100_i64
ctoken = produce_playlist_continuation(playlist.id, offset)
initial_data = JSON.parse(request_youtube_api_browse(ctoken)).as_h
initial_data = request_youtube_api_browse(ctoken)
else
response = YT_POOL.client &.get("/playlist?list=#{playlist.id}&gl=US&hl=en")
initial_data = extract_initial_data(response.body)