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

Error 400 (Bad Request) from YTM #116

Closed
ShieldNavalny opened this issue Nov 15, 2024 · 1 comment
Closed

Error 400 (Bad Request) from YTM #116

ShieldNavalny opened this issue Nov 15, 2024 · 1 comment

Comments

@ShieldNavalny
Copy link

Hi.
When I'm trying to use the script to transfer a playlist I'm recieving the error ytmusicapi.exceptions.YTMusicServerError: Server returned HTTP 400: Bad Request. Request contains an invalid argument.

Here is a full log from Powershell terminal (removed spotify code but obviously it's working fine):

PS C:\Users\ionov> spotify_to_ytmusic create https://open.spotify.com/playlist/6SP7sA4Qlmh7sB73sCfvIG?si=bbb703a963d74a2a
Getting Spotify tracks...
Using `localhost` as redirect URI without a port. Specify a port (e.g. `localhost:8080`) to allow automatic retrieval of authentication code instead of having to copy and paste the URL your browser is redirected to.
Enter the URL you were redirected to: http://localhost/?code=CORRECTCODEWASHERE
Spotify tracks: 100/126
Spotify tracks: 126/126
Searching YouTube...
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "c:\users\ionov\.local\bin\spotify_to_ytmusic.exe\__main__.py", line 7, in <module>
  File "C:\Users\ionov\pipx\venvs\spotify-to-ytmusic\Lib\site-packages\spotify_to_ytmusic\main.py", line 98, in main
    args.func(args)
  File "C:\Users\ionov\pipx\venvs\spotify-to-ytmusic\Lib\site-packages\spotify_to_ytmusic\controllers.py", line 77, in create
    _create_ytmusic(args, playlist, ytmusic)
  File "C:\Users\ionov\pipx\venvs\spotify-to-ytmusic\Lib\site-packages\spotify_to_ytmusic\controllers.py", line 63, in _create_ytmusic
    videoIds = ytmusic.search_songs(playlist["tracks"])
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ionov\pipx\venvs\spotify-to-ytmusic\Lib\site-packages\spotify_to_ytmusic\ytmusic.py", line 35, in search_songs
    result = self.api.search(query)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ionov\pipx\venvs\spotify-to-ytmusic\Lib\site-packages\ytmusicapi\mixins\search.py", line 183, in search
    response = self._send_request(endpoint, body)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ionov\pipx\venvs\spotify-to-ytmusic\Lib\site-packages\ytmusicapi\ytmusic.py", line 241, in _send_request
    raise YTMusicServerError(message + error)
ytmusicapi.exceptions.YTMusicServerError: Server returned HTTP 400: Bad Request.
Request contains an invalid argument.

Here is my settings.ini (redacted a bit):

[youtube]
headers = {"scope": "https://www.googleapis.com/auth/youtube", "token_type": "Bearer", "access_token": "REDACTED", "refresh_token": "REDACTED", "expires_at": 1731734384, "expires_in": 65588}
user_id = 

[spotify]
client_id = 53074262dc2142fe828d83125b577739
client_secret = REDACTED
use_oauth = yes

I'm using Python 3.11, pipx and everything is installed on Windows 11 Pro machine. I also tried to perform the same operation on Ubuntu 23.03 machine with Python 3.11, same results.

I tried to change a YTM account. I also doublechecked that my account is "active" and no restriction is applied.
Ofc tried different playlists. It's happens with everything.

Also tried to reinstall App multiple times. Nothing works so I'm kinda lost

@sigma67
Copy link
Owner

sigma67 commented Nov 15, 2024

It is an upstream issue with ytmusicapi/server side update

@sigma67 sigma67 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 15, 2024
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

2 participants