Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: Server returned HTTP 400: Bad Request. #19

Open
djlivooo opened this issue Nov 13, 2023 · 4 comments
Open

Exception: Server returned HTTP 400: Bad Request. #19

djlivooo opened this issue Nov 13, 2023 · 4 comments

Comments

@djlivooo
Copy link

Hi, When I play one of my playlists I get this error on some songs.

First, it starts normally, plays a few songs correctly, and then it starts to get this error, and then it keeps playing songs normally and so on. What is the reason for this error?

Traceback (most recent call last):
File "C:\Users\varga\Downloads\Spotify-To-Youtube-main\spotifyToYoutube.py", line 26, in add_to_playlist
ytmusic.add_playlist_items(target_playlist, [search_results[0]['videoId']])
File "C:\Users\varga\AppData\Local\Programs\Python\Python311\Lib\site-packages\ytmusicapi\mixins\playlists.py", line 275, in add_playlist_items
response = self._send_request(endpoint, body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\varga\AppData\Local\Programs\Python\Python311\Lib\site-packages\ytmusicapi\ytmusic.py", line 142, in _send_request
raise Exception(message + error)
Exception: Server returned HTTP 400: Bad Request.
This functionality is not available right now. Please try again later.

@fire4rt
Copy link

fire4rt commented Nov 16, 2023

Getting the same. One thing to note, it starts happening around 290 songs. No songs are added after that, each songs gets the error. This looks like a response from google/youtube, so maybe the cookie expires? If I try to start it again afterwards with the same cookie I get a 401 Unauthorized.

@fire4rt
Copy link

fire4rt commented Nov 21, 2023

Getting the same. One thing to note, it starts happening around 290 songs. No songs are added after that, each songs gets the error. This looks like a response from google/youtube, so maybe the cookie expires? If I try to start it again afterwards with the same cookie I get a 401 Unauthorized.

Small update, I am not sure it if has anything to do with the authentication. I updated ytmisucapi and changed your code do use the oauth authentication method, but still started getting 400 Bad request from ytmusic after the 293rd song. I can't see anything wrong with the code, though I don't understand coding that much and I am not sure if I changed things correctly...but to me it looks like the issue is coming from YouTube.

@kgielis
Copy link

kgielis commented Nov 25, 2023

I tried several methods resolving this issue (updating the cookie every 290 songs, creating new instances of SpotifyToYoutube). Only thing that seemed to work was splitting large playlists into several smaller playlists and then manually combining them after they were migrated. I can create a PR to fix this if you want @rimonhanna.

@rimonhanna
Copy link
Owner

@kgielis appreciatie the debugging, if you open a PR I would happily review it an merge it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants