ytmusicapi icon indicating copy to clipboard operation
ytmusicapi copied to clipboard

ytmusic.upload_song() does not return songid

Open xplorr opened this issue 6 years ago • 2 comments

When uploading a new song using ytmusic.upload_song(), the function should return a songid when succeeded. Now it only returns STATUS_SUCCEEDED but no id, so you cannot add the song to a playlist afterwards. There is also no reliable function to retrieve the songid from the song just uploaded (YTMusic.search() is not specific enough and unreliable). There is only ytmusic.get_library_upload_songs(50000) to retrieve all uploaded songs, but this can take long if you have a large library (a few minutes for a library of 20000 songs. Can you either fix this or create a function to get the songid of the last uploaded song. Other option is to create a filter in the YTMusic.search() to get the last uploaded song.

xplorr avatar Aug 22 '20 11:08 xplorr

It's not possible to return the videoId due to the way the upload flow works. After you upload a song/video, it is processed asynchronously, as you can see in your uploaded songs tab. I assume the videoId is assigned after processing is finished - or at least it's not available to the client before that.

The upload request itself only returns an empty response, as you can see if you inspect it in the browser.

Sorry if this is not helpful, but it's a limitation of YTMusic itself. Unless we get some sorting options on the uploaded songs list there's no way to just get the most recently uploaded song either.

sigma67 avatar Aug 22 '20 19:08 sigma67

Thanks! I already suspected this. It's a pity.

xplorr avatar Aug 22 '20 19:08 xplorr