[GH-ISSUE #123] Search: KeyError: 'playNavigationEndpoint' #88

Closed
opened 2026-02-27 22:07:57 +03:00 by kerem · 2 comments
Owner

Originally created by @chaos87 on GitHub (Dec 16, 2020).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/123

First of all thanks for the quick turnaround with v0.12

I'm testing it, and I found an example where search breaks

from ytmusicapi import YTMusic
ytmusic = YTMusic()

results = ytmusic.search("dinosaur jr.")

returns

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-3361a2d6b6c2> in <module>()
----> 1 results = ytmusic.search("dinosaur jr")

/usr/local/lib/python3.6/dist-packages/ytmusicapi/parsers/browsing.py in parse_search_results(self, results, resultType)
     29             if resultType in ['song', 'video']:
     30                 search_result['videoId'] = nav(
---> 31                     data, PLAY_BUTTON)['playNavigationEndpoint']['watchEndpoint']['videoId']
     32                 search_result['title'] = get_item_text(data, 0)
     33 

KeyError: 'playNavigationEndpoint'
Originally created by @chaos87 on GitHub (Dec 16, 2020). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/123 First of all thanks for the quick turnaround with v0.12 I'm testing it, and I found an example where search breaks ```python from ytmusicapi import YTMusic ytmusic = YTMusic() results = ytmusic.search("dinosaur jr.") ``` returns ```python --------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-3-3361a2d6b6c2> in <module>() ----> 1 results = ytmusic.search("dinosaur jr") /usr/local/lib/python3.6/dist-packages/ytmusicapi/parsers/browsing.py in parse_search_results(self, results, resultType) 29 if resultType in ['song', 'video']: 30 search_result['videoId'] = nav( ---> 31 data, PLAY_BUTTON)['playNavigationEndpoint']['watchEndpoint']['videoId'] 32 search_result['title'] = get_item_text(data, 0) 33 KeyError: 'playNavigationEndpoint' ```
kerem 2026-02-27 22:07:57 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@sigma67 commented on GitHub (Dec 16, 2020):

This must be new as well, I don't recall seeing unplayable items turn up in search results. Thanks for testing it!

<!-- gh-comment-id:746232957 --> @sigma67 commented on GitHub (Dec 16, 2020): This must be new as well, I don't recall seeing unplayable items turn up in search results. Thanks for testing it!
Author
Owner

@sigma67 commented on GitHub (Dec 16, 2020):

Feel free to reopen if you happen to find another query with issues.

<!-- gh-comment-id:746243344 --> @sigma67 commented on GitHub (Dec 16, 2020): Feel free to reopen if you happen to find another query with issues.
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#88
No description provided.