[GH-ISSUE #316] Usage example not working #244

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

Originally created by @Twometer on GitHub (Nov 12, 2022).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/316

I've tried the usage example on the README page, and it crashes with the following error

Traceback (most recent call last):
  File "E:\Dev\ytm_test.py", line 6, in <module>
    yt.add_playlist_items(playlistId, [result[0]['videoId']])
KeyError: 'videoId'

I ran it 10 times, and it actually worked once for some reason.

Originally created by @Twometer on GitHub (Nov 12, 2022). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/316 I've tried the usage example on the README page, and it crashes with the following error ``` Traceback (most recent call last): File "E:\Dev\ytm_test.py", line 6, in <module> yt.add_playlist_items(playlistId, [result[0]['videoId']]) KeyError: 'videoId' ``` I ran it 10 times, and it actually worked once for some reason.
kerem closed this issue 2026-02-27 22:08:48 +03:00
Author
Owner

@Twometer commented on GitHub (Nov 12, 2022):

The problem was that it randomly returned an album instead of a song. Replacing the search command with this one

yt.search(query, filter="songs")

fixes it

<!-- gh-comment-id:1312513371 --> @Twometer commented on GitHub (Nov 12, 2022): The problem was that it randomly returned an album instead of a song. Replacing the search command with this one ```python yt.search(query, filter="songs") ``` fixes it
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#244
No description provided.