linsomniac / spotify_to_ytmusic

Copy playlists and liked music from Spotify to YTMusic
Creative Commons Zero v1.0 Universal
1.77k stars 111 forks source link

How to fix Couldn't load URL: https://api.spotify.com/v1/users/ 404 Not found #114

Open oliviertremblay opened 5 days ago

oliviertremblay commented 5 days ago

The problem happens when trying to backup from spotify and trying to reach the endpoint that returns liked tracks for a user. When I looked in the Spotify docs, the endpoint was different than the one specified in the code.

To solve the issue:

In spotify_backup.py at line 155, I replaced the endpoint from

_liked_tracks = spotify.list( "users/{user_id}/tracks".format(user_id=user_idescaped), {"limit": 50} )

to

_likedtracks = spotify.list("me/tracks", {"limit": 50})

Based on the documentation found here: https://developer.spotify.com/documentation/web-api/reference/get-users-saved-tracks

jquesgar commented 4 days ago

Thanks, saved my day! Had to edit the spotify_backup.py in the package and worked like a charm.!

tenasd commented 3 days ago

I have the same issue, I can't back up my playlist from spotify. How do I do what you've said?

jtorvald commented 1 day ago

@oliviertremblay had the same thanks.

@tenasd depends on your OS. You need to find the spotify_backup.py file and make the change above. On linux ran the find command in my user dir and got one result:

$ find . -name spotify_backup.py 
./.local/share/pipx/venvs/spotify2ytmusic/lib/python3.12/site-packages/spotify2ytmusic/spotify_backup.py

Editted that file and re-ran the s2yt_gui command

TaZ4444 commented 12 hours ago

For windows the "spotify_backup.py" file is located in

C:\Users\YourUserName\AppData\Local\Programs\Python\Python312\Lib\site-packages\spotify2ytmusic

As OP - edit line 155/156 - mine didn't work at first as it had a trailing ) - so be aware of that. Once I fixed that it backed up my playlists no problem

oliviertremblay commented 11 hours ago

Thanks for replying @TaZ4444 I DMed the project owner on reddit so that he may approve the PR I raised that fixes the problem.