HTTP 400 error when using add_playlist_items #398
Unanswered
CannedBreb89
asked this question in
Q&A
Replies: 1 comment
-
Tests are passing, so there's something wrong with your input. Please debug |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Using add_playlist_items causes a "Bad Request" error. I've tried different IDs, playlists, and songs, using the IDs instead of variables, I tried copying the code from the tests, but nothing's worked. Any help would be appreciated, thank you.
Code:
`from ytmusicapi import YTMusic
yt = YTMusic("oauth.json")
songSearch = str("Back in Black")
searchResults = yt.search(query=songSearch, filter='songs', scope=None, limit=1, ignore_spelling=False)
playlists = yt.get_library_playlists(limit=5)
#Song search and playlist info (respectively)
songData = searchResults[0]
listData = playlists[0]
#Song and playlist IDs (respectively)
songID = songData['videoId']
listID = listData['playlistId']
print("Target Playlist ID:", listID)
print("Song title:", songData['title'], "\nAlbum title:", songData['album']['name'], "\nSong ID:", songData['videoId'])
yt.add_playlist_items(playlistId=listID, videoIds=songID, source_playlist=listID, duplicates=False)`
Output:
Target Playlist ID: PLqfZ3LIWPHtZECZe00K9rAfOlba8XKm7G Song title: Back In Black Album title: Back In Black Song ID: 9vWNauaZAgg Traceback (most recent call last): File "c:\Users\[user]\YTMusicBot\ytaudio.py", line 20, in <module> yt.add_playlist_items(playlistId=listID, videoIds=songID, source_playlist=listID, duplicates=False) File "c:\Users\[user]\YTMusicBot\ytmusicapi\mixins\playlists.py", line 328, in add_playlist_items response = self._send_request(endpoint, body) File "c:\Users\[user]\YTMusicBot\ytmusicapi\ytmusic.py", line 132, in _send_request raise Exception(message + error) Exception: Server returned HTTP 400: Bad Request. Request contains an invalid argument.
Beta Was this translation helpful? Give feedback.
All reactions