[GH-ISSUE #170] Problems playing album from automation #131

Closed
opened 2026-02-27 22:08:12 +03:00 by kerem · 1 comment
Owner

Originally created by @SifuDaigo on GitHub (Feb 15, 2021).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/170

Whenever I try to start an album via the play_media-service and feeding it the album-ID I get the following error:

Traceback (most recent call last): File "/config/custom_components/ytube_music_player/media_player.py", line 1080, in play_media self._tracks = self._api.get_album(browseId=media_id)['tracks'] File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/browsing.py", line 432, in get_album response = self._send_request(endpoint, body) File "/usr/local/lib/python3.8/site-packages/ytmusicapi/ytmusic.py", line 129, in _send_request raise Exception(message + error) Exception: Server returned HTTP 400: Bad Request. Unknown error.
Traceback (most recent call last): File "/config/custom_components/ytube_music_player/media_player.py", line 1078, in play_media self._tracks = self._api.get_playlist(playlistId=media_id)['tracks'] File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/playlists.py", line 67, in get_playlist results = nav(response, File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 210, in nav raise err File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 204, in nav root = root[k] KeyError: 'contents'

I tried both media_content_type-possibilities of album and playlist. Playing albums via the media-browser works fine!

Originally created by @SifuDaigo on GitHub (Feb 15, 2021). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/170 Whenever I try to start an album via the `play_media`-service and feeding it the album-ID I get the following error: ``` Traceback (most recent call last): File "/config/custom_components/ytube_music_player/media_player.py", line 1080, in play_media self._tracks = self._api.get_album(browseId=media_id)['tracks'] File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/browsing.py", line 432, in get_album response = self._send_request(endpoint, body) File "/usr/local/lib/python3.8/site-packages/ytmusicapi/ytmusic.py", line 129, in _send_request raise Exception(message + error) Exception: Server returned HTTP 400: Bad Request. Unknown error. Traceback (most recent call last): File "/config/custom_components/ytube_music_player/media_player.py", line 1078, in play_media self._tracks = self._api.get_playlist(playlistId=media_id)['tracks'] File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/playlists.py", line 67, in get_playlist results = nav(response, File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 210, in nav raise err File "/usr/local/lib/python3.8/site-packages/ytmusicapi/parsers/utils.py", line 204, in nav root = root[k] KeyError: 'contents' ``` I tried both `media_content_type`-possibilities of `album` and `playlist`. Playing albums via the media-browser works fine!
kerem closed this issue 2026-02-27 22:08:12 +03:00
Author
Owner

@SifuDaigo commented on GitHub (Feb 15, 2021):

Update: Got the wrong media_id - copied it from the URL on the Detail-Page of the album - not on https://music.youtube.com/library/albums. Sorry for the confusion!

<!-- gh-comment-id:779111428 --> @SifuDaigo commented on GitHub (Feb 15, 2021): Update: Got the wrong media_id - copied it from the URL on the Detail-Page of the album - not on https://music.youtube.com/library/albums. Sorry for the confusion!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#131
No description provided.