ytmusicapi icon indicating copy to clipboard operation
ytmusicapi copied to clipboard

`get_album` issues with audiobooks

Open sigma67 opened this issue 3 months ago • 2 comments

Originally reported by @Thorsten1982

Screenshot 2025-12-05 060438

and another DuckTales audiobook shows this error, I think this is also due to the ytmusicapi.

2025-12-05 06:05:53.867 WARNING (MainThread) [music_assistant] Exception in task Task-5089 - target: <function MediaControllerBase.get_provider_item at 0x7fc856c2f920>: "Unable to find 'playNavigationEndpoint' using path ['contents', 0, 'musicResponsiveListItemRenderer', 'overlay', 'musicItemThumbnailOverlayRenderer', 'content', 'musicPlayButtonRenderer', 'playNavigationEndpoint', 'watchEndpoint', 'playlistId'] on {'trackingParams': 'CGwQyN4CIhMIk-2Fs9alkQMVNER6BR0VZCC2', 'playIcon': {'iconType': 'PLAY_ARROW'}, 'pauseIcon': {'iconType': 'PAUSE'}, 'iconColor': 4294967295, 'backgroundColor': 0, 'activeBackgroundColor': 0, 'loadingIndicatorColor': 14745645, 'playingIcon': {'iconType': 'VOLUME_UP'}, 'iconLoadingColor': 0, 'activeScaleFactor': 1, 'buttonSize': 'MUSIC_PLAY_BUTTON_SIZE_SMALL', 'rippleTarget': 'MUSIC_PLAY_BUTTON_RIPPLE_TARGET_SELF'}, exception: 'playNavigationEndpoint'"
Traceback (most recent call last):
  File "/app/venv/lib/python3.13/site-packages/ytmusicapi/navigation.py", line 122, in nav
    root = root[k]  # type: ignore[index]
           ~~~~^^^
KeyError: 'playNavigationEndpoint'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/media/base.py", line 507, in get_provider_item
    return cast("ItemCls", await provider.get_item(self.media_type, item_id))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/models/music_provider.py", line 478, in get_item
    return await self.get_album(prov_item_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/cache.py", line 414, in wrapper
    result = await func(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/providers/ytmusic/__init__.py", line 328, in get_album
    if album_obj := await get_album(prov_album_id=prov_album_id, language=self.language):
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/providers/ytmusic/helpers.py", line 63, in get_album
    return await asyncio.to_thread(_get_album)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/app/venv/lib/python3.13/site-packages/music_assistant/providers/ytmusic/helpers.py", line 49, in _get_album
    album_playlist = ytm.get_playlist(playlistId=album["audioPlaylistId"], limit=None)
  File "/app/venv/lib/python3.13/site-packages/ytmusicapi/mixins/playlists.py", line 142, in get_playlist
    return parse_audio_playlist(response, limit, request_func_continuations)
  File "/app/venv/lib/python3.13/site-packages/ytmusicapi/parsers/playlists.py", line 112, in parse_audio_playlist
    playlist["id"] = nav(
                     ~~~^
        content_data, [*CONTENT, MRLIR, *PLAY_BUTTON, "playNavigationEndpoint", *WATCH_PLAYLIST_ID]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/venv/lib/python3.13/site-packages/ytmusicapi/navigation.py", line 126, in nav
    raise type(e)(f"Unable to find '{k}' using path {items!r} on {root!r}, exception: {e}")
KeyError: "Unable to find 'playNavigationEndpoint' using path ['contents', 0, 'musicResponsiveListItemRenderer', 'overlay', 'musicItemThumbnailOverlayRenderer', 'content', 'musicPlayButtonRenderer', 'playNavigationEndpoint', 'watchEndpoint', 'playlistId'] on {'trackingParams': 'CGwQyN4CIhMIk-2Fs9alkQMVNER6BR0VZCC2', 'playIcon': {'iconType': 'PLAY_ARROW'}, 'pauseIcon': {'iconType': 'PAUSE'}, 'iconColor': 4294967295, 'backgroundColor': 0, 'activeBackgroundColor': 0, 'loadingIndicatorColor': 14745645, 'playingIcon': {'iconType': 'VOLUME_UP'}, 'iconLoadingColor': 0, 'activeScaleFactor': 1, 'buttonSize': 'MUSIC_PLAY_BUTTON_SIZE_SMALL', 'rippleTarget': 'MUSIC_PLAY_BUTTON_RIPPLE_TARGET_SELF'}, exception: 'playNavigationEndpoint'"
2025-12-05 06:05:53.870 ERROR (MainThread) [music_assistant.webserver] Error handling message: CommandMessage(message_id='c0321f65-85c1-43cb-ac53-1484dfdad89a', command='player_queues/play_media', args={'queue_id': '60196686-12e2-b5aa-1bee-3b61e4a9bfc0', 'media': ['ytmusic://album/MPREb_OJkxCUCP5hF'], 'option': 'replace'})
Traceback (most recent call last):
  File "/app/venv/lib/python3.13/site-packages/ytmusicapi/navigation.py", line 122, in nav
    root = root[k]  # type: ignore[index]
           ~~~~^^^
KeyError: 'playNavigationEndpoint'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/webserver/websocket_client.py", line 232, in _run_handler
    result = await result
             ^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/player_queues.py", line 427, in play_media
    media_item = await self.mass.music.get_item_by_uri(item)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/music.py", line 599, in get_item_by_uri
    return await self.get_item(
           ^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/music.py", line 647, in get_item
    return await ctrl.get(
           ^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/media/albums.py", line 81, in get
    album = await super().get(
            ^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/media/base.py", line 300, in get
    return await self.get_provider_item(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/helpers/util.py", line 818, in wrapper
    return await task
           ^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/media/base.py", line 507, in get_provider_item
    return cast("ItemCls", await provider.get_item(self.media_type, item_id))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/models/music_provider.py", line 478, in get_item
    return await self.get_album(prov_item_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/controllers/cache.py", line 414, in wrapper
    result = await func(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/providers/ytmusic/__init__.py", line 328, in get_album
    if album_obj := await get_album(prov_album_id=prov_album_id, language=self.language):
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/venv/lib/python3.13/site-packages/music_assistant/providers/ytmusic/helpers.py", line 63, in get_album
    return await asyncio.to_thread(_get_album)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/threads.py", line 25, in to_thread
    return await loop.run_in_executor(None, func_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/app/venv/lib/python3.13/site-packages/music_assistant/providers/ytmusic/helpers.py", line 49, in _get_album
    album_playlist = ytm.get_playlist(playlistId=album["audioPlaylistId"], limit=None)
  File "/app/venv/lib/python3.13/site-packages/ytmusicapi/mixins/playlists.py", line 142, in get_playlist
    return parse_audio_playlist(response, limit, request_func_continuations)
  File "/app/venv/lib/python3.13/site-packages/ytmusicapi/parsers/playlists.py", line 112, in parse_audio_playlist


    playlist["id"] = nav(
                     ~~~^
        content_data, [*CONTENT, MRLIR, *PLAY_BUTTON, "playNavigationEndpoint", *WATCH_PLAYLIST_ID]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/venv/lib/python3.13/site-packages/ytmusicapi/navigation.py", line 126, in nav
    raise type(e)(f"Unable to find '{k}' using path {items!r} on {root!r}, exception: {e}")
KeyError: "Unable to find 'playNavigationEndpoint' using path ['contents', 0, 'musicResponsiveListItemRenderer', 'overlay', 'musicItemThumbnailOverlayRenderer', 'content', 'musicPlayButtonRenderer', 'playNavigationEndpoint', 'watchEndpoint', 'playlistId'] on {'trackingParams': 'CGwQyN4CIhMIk-2Fs9alkQMVNER6BR0VZCC2', 'playIcon': {'iconType': 'PLAY_ARROW'}, 'pauseIcon': {'iconType': 'PAUSE'}, 'iconColor': 4294967295, 'backgroundColor': 0, 'activeBackgroundColor': 0, 'loadingIndicatorColor': 14745645, 'playingIcon': {'iconType': 'VOLUME_UP'}, 'iconLoadingColor': 0, 'activeScaleFactor': 1, 'buttonSize': 'MUSIC_PLAY_BUTTON_SIZE_SMALL', 'rippleTarget': 'MUSIC_PLAY_BUTTON_RIPPLE_TARGET_SELF'}, exception: 'playNavigationEndpoint'"

And generally, I'm having trouble finding and playing a complete album in the audiobooks. If I want to play Gigantosaurus Episode 3, it's not found; only the artist or the individual track is found. Screenshot 2025-12-05 061530

sigma67 avatar Dec 05 '25 07:12 sigma67

@Thorsten1982 regarding Die drei ???, I don't think Music Assistant is using the shows or singles returned by get_artist.

another DuckTales audiobook shows this error

#840 will fix that error. If you're referring to this audiobook, is it available in your region?

If I want to play Gigantosaurus Episode 3, it's not found; only the artist or the individual track is found.

What search terms have you tried? For me, yt.search("Gigantosaurus Folge 3") returns this result:

{
	"category": null,
	"resultType": "album",
	"title": "Folge 3: Der größte Held (Das Original-Hörspiel zur TV-Serie)",
	"type": "Show",
	"playlistId": "OLAK5uy_kA71SuR5U21ZXvxaGzjcblTp6bPnU_SUY",
	"duration": null,
	"year": "2021",
	"artists": [
	  {
	    "name": "Gigantosaurus",
	    "id": "UCx33riwA-SMwj6MmNxsqAKw"
	  }
	],
	"browseId": "MPREb_9PQDD6OM9QP",
	"isExplicit": false,
	"thumbnails": []
}

sgvictorino avatar Dec 06 '25 04:12 sgvictorino

@Thorsten1982 regarding Die drei ???, I don't think Music Assistant is using the shows or singles returned by get_artist.

another DuckTales audiobook shows this error

#840 will fix that error. If you're referring to this audiobook, is it available in your region? Yes IT IS available

If I want to play Gigantosaurus Episode 3, it's not found; only the artist or the individual track is found.

What search terms have you tried? For me, yt.search("Gigantosaurus Folge 3") returns this result:

{
	"category": null,
	"resultType": "album",
	"title": "Folge 3: Der größte Held (Das Original-Hörspiel zur TV-Serie)",
	"type": "Show",
	"playlistId": "OLAK5uy_kA71SuR5U21ZXvxaGzjcblTp6bPnU_SUY",
	"duration": null,
	"year": "2021",
	"artists": [
	  {
	    "name": "Gigantosaurus",
	    "id": "UCx33riwA-SMwj6MmNxsqAKw"
	  }
	],
	"browseId": "MPREb_9PQDD6OM9QP",
	"isExplicit": false,
	"thumbnails": []
}

When I use the search command in Music Assistant, I get this as a response.

action: music_assistant.search
data:
  config_entry_id: 01JYJRMQW02754XE5G078D0ZJ1
name: Gigantosaurus Folge 3
artists: []
albums: []
tracks:
  - media_type: track
    uri: ytmusic://track/g6SMLORcGL8
    name: Gigantosaurus - Dare To Roar | Official Music
    version: ""
    image: null
    favorite: false
    explicit: null
    artists:
      - media_type: artist
        uri: ytmusic://artist/UCoCjuyM2NePdBRIp2plim4w
        name: Gigantosaurus
        version: ""
        image: null
  - media_type: track
    uri: ytmusic://track/82VDQ6jVENU
    name: >-
      Gigantosaurus [OFFICIAL SONG] 🦖 Mighty Dinosaurs 🦖 🎵 dinosaur cartoon
      for kids
    version: ""
    image: null
    favorite: false
    explicit: null
    artists:
      - media_type: artist
        uri: ytmusic://artist/UCoCjuyM2NePdBRIp2plim4w
        name: Gigantosaurus
        version: ""
        image: null
  - media_type: track
    uri: ytmusic://track/wX6c1He9NsA
    name: The Amazing Gigantosaurus Song 🦖
    version: ""
    image: null
    favorite: false
    explicit: null
    artists:
      - media_type: artist
        uri: ytmusic://artist/UCDo-kg7KZJT84s7jLf9ISLg
        name: Stop Motion Twins
        version: ""
        image: null
  - media_type: track
    uri: ytmusic://track/30ZoMIzxddU
    name: Giganotosaurus | Dinosaur Songs from Dinostory by Howdytoons | S2E2
    version: ""
    image: null
    favorite: false
    explicit: null
    artists:
      - media_type: artist
        uri: ytmusic://artist/UCjEQ6rln5lMRZVro-i1TaGg
        name: Howdytoons
        version: ""
        image: null
  - media_type: track
    uri: ytmusic://track/RkWynsS1Dkk
    name: Folgt dem Anführer - Teil 3
    version: ""
    image: >-
      https://lh3.googleusercontent.com/BnOv2-zgbP5iz3z9eiVmSF4latROYI3UxWsIq9u99-wutlQGo6BX577ygBjhn7dbnFZf8l-s-t95pSk=w600-h600-p
    favorite: false
    explicit: false
    artists:
      - media_type: artist
        uri: ytmusic://artist/UCx33riwA-SMwj6MmNxsqAKw
        name: Gigantosaurus
        version: ""
        image: null
playlists: []
radio: []
audiobooks: []
podcasts: []

Thorsten1982 avatar Dec 06 '25 05:12 Thorsten1982