[GH-ISSUE #786] get_album failure on specific songs #499

Closed
opened 2026-02-27 23:01:08 +03:00 by kerem · 0 comments
Owner

Originally created by @Love-Pengy on GitHub (Jul 4, 2025).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/786

  • I confirm that I have read the FAQ

Describe the bug

Some very specfic songs cause get_album to fail.

ytmusicapi version

1.10.3

To Reproduce

Steps to reproduce the behavior:

Create a script along the lines of:

from ytmusicapi import YTMusic

ytmusic = YTMusic()
search_result = ytmusic.search("restriction team grimoire", filter="songs")
album = ytmusic.get_album(search_result[0]["album"]["id"])

And observe results:

Traceback (most recent call last):
  File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/navigation.py", line 117, in nav
    root = root[k]
           ~~~~^^^
KeyError: 'runs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/bee/Projects/test/err.py", line 5, in <module>
    album = ytmusic.get_album(search_result[0]["album"]["id"])
  File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/mixins/browsing.py", line 556, in get_album
    album = parse_album_header_2024(response)
  File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/parsers/albums.py", line 54, in parse_album_header_2024
    album_info["artists"] = [parse_base_header(header)["author"]]
                             ~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/parsers/podcasts.py", line 69, in parse_base_header
    "name": nav(strapline, [*RUN_TEXT]),
            ~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/navigation.py", line 121, in nav
    raise type(e)(f"Unable to find '{k}' using path {items!r} on {root!r}, exception: {e}")
KeyError: "Unable to find 'runs' using path ['runs', 0, 'text'] on {}, exception: 'runs'"

Additional Info

99% of the other calls I make to this function work flawlessly, only some will trip it up

Originally created by @Love-Pengy on GitHub (Jul 4, 2025). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/786 - [x] I confirm that I have read the [FAQ](https://ytmusicapi.readthedocs.io/en/stable/faq.html#why-is-ytmusicapi-returning-more-results-than-requested-with-the-limit-parameter) **Describe the bug** Some very specfic songs cause get_album to fail. **ytmusicapi version** 1.10.3 **To Reproduce** Steps to reproduce the behavior: Create a script along the lines of: ```python from ytmusicapi import YTMusic ytmusic = YTMusic() search_result = ytmusic.search("restriction team grimoire", filter="songs") album = ytmusic.get_album(search_result[0]["album"]["id"]) ``` And observe results: ``` Traceback (most recent call last): File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/navigation.py", line 117, in nav root = root[k] ~~~~^^^ KeyError: 'runs' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/bee/Projects/test/err.py", line 5, in <module> album = ytmusic.get_album(search_result[0]["album"]["id"]) File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/mixins/browsing.py", line 556, in get_album album = parse_album_header_2024(response) File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/parsers/albums.py", line 54, in parse_album_header_2024 album_info["artists"] = [parse_base_header(header)["author"]] ~~~~~~~~~~~~~~~~~^^^^^^^^ File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/parsers/podcasts.py", line 69, in parse_base_header "name": nav(strapline, [*RUN_TEXT]), ~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/bee/Projects/test/.venv/lib/python3.13/site-packages/ytmusicapi/navigation.py", line 121, in nav raise type(e)(f"Unable to find '{k}' using path {items!r} on {root!r}, exception: {e}") KeyError: "Unable to find 'runs' using path ['runs', 0, 'text'] on {}, exception: 'runs'" ``` **Additional Info** 99% of the other calls I make to this function work flawlessly, only some will trip it up
kerem 2026-02-27 23:01:08 +03:00
  • closed this issue
  • added the
    bug
    label
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#499
No description provided.