Closed JorgWashingmache closed 7 months ago
This is probably a unicode decoding issue, could you try running this command and pasting the output:
python3 -c "print(repr(open('playlists.json', 'r').read()[520:620]))"
In the directory where your playlist.json file is.
I probably just need to open it with an encoding.
Thanks!
I wasn't able to reproduce this, but I've pushed a code change that specifies a utf-8 encoding for the playlists.json file, and can also take the argument "--spotify-playlists-encoding" argument to change it. I think doing it in UTF-8 is going to solve it. Please give it a shot and let me know.
Hi @linsomniac ,
First of all, a huge thanks for your work. It's amazing !
Got the same problem so I tried with --spotify-playlists-encoding=UTF-8.
The script started normally, but after maybe 20 minutes, it started to show me this :
ERROR: (Retrying) Server returned HTTP 400: Bad Request.
This functionality is not available right now. Please try again later. in 160 seconds
Don't know if I made something wrong.
Edit : it ended up with :
Looking up playlist '': id=None
Traceback (most recent call last):
File "/opt/homebrew/bin/s2yt_copy_all_playlists", line 8, in <module>
sys.exit(copy_all_playlists())
^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/spotify2ytmusic/cli.py", line 286, in copy_all_playlists
dst_pl_id = yt.create_playlist(title=pl_name, description=pl_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/ytmusicapi/mixins/playlists.py", line 240, in create_playlist
response = self._send_request(endpoint, body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/ytmusicapi/ytmusic.py", line 238, in _send_request
raise Exception(message + error)
Exception: Server returned HTTP 400: Bad Request.
Request contains an invalid argument.
python3 -c "print(repr(open('playlists.json', 'r').read()[520:620]))"
'", "DO", "DE", "EC", "EE", "SV", "FI", "FR", "GR", "GT", "HN", "HK", "HU", "IS", "IE", "IT", "LV", "'
@Vercety87 Your issue looks like something addressed over in #2 and the user there was able to work around it by slowing down the rate of interaction with YTMusic. Try adding the argument "--track-sleep 3" (which worked for the user over in #2 ) and you can try adjusting that up or down. The default is 0.1 seconds.
Looking a little deeper into this, I see that this is happening on the "create_playlist". Have you tried running the program a few times, does it always have that "yt.create_playlist" line in it, or is it failing at different points in the run.
It is safe to re-run the programs, it should not add duplicates. Definitely try the "--track-sleep 3" though. That will slow it way down, but may end up getting it to work.
Other calls to YTMusic were wrapped in retries with slowdown, but the create playlist call was not. I just pushed a code update that does that. That should help with @Vercety87 's problem, you may want to use a --track-sleep with it as well though.
Thanks, just updated on my computer. Trying again with track-sleep, I'll let you know when it is done.
Hi @linsomniac , got this error now :
`Playlist done!
Looking up playlist 'Test': id=None ERROR: (Retrying) maximum recursion depth exceeded in comparison in 5 seconds ERROR: (Retrying) maximum recursion depth exceeded in comparison in 10 seconds ERROR: (Retrying) maximum recursion depth exceeded in comparison in 20 seconds ERROR: (Retrying) maximum recursion depth exceeded in comparison in 40 seconds ERROR: (Retrying) maximum recursion depth exceeded in comparison in 80 seconds ERROR: (Retrying) maximum recursion depth exceeded in comparison in 160 seconds ERROR: (Retrying) maximum recursion depth exceeded in comparison in 320 seconds ERROR: (Retrying) maximum recursion depth exceeded in comparison in 640 seconds ERROR: (Retrying) maximum recursion depth exceeded in comparison in 1280 seconds`
This playlist had no title at the begining. I add one manually on the JSON, but now can't go futher because of the missing ID
I've pushed a new version that will give me some more diagnostics information. Please run it and let me know the output.
Thank you, here the result :
Ok, I think I've got it, thank you for that!
Looks like it did the job.
Re run the script all night, ended up with an error this morning but as I already edited my playlist.json. I will redo the test from scratch today. Thanks.
@linsomniac it's all good. No more errors on my original playlist.json. Thanks
IDK what this is, hope you can help me