-
Notifications
You must be signed in to change notification settings - Fork 192
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
OAuth is not working. 400 Bad Request error #136
Comments
Thanks a million for this! You helped me get this working! 🎉 I'm using PIPX (on a mac) to install and run this, so it was a smidge more fiddly. For anyone looking for a verbose step by step, this is the full process I went through to copy a playlist: Step By Step
# ...
def get_ytmusic() -> YTMusic:
"""
@@@
"""
if not os.path.exists("browser.json"):
print("ERROR: No file 'browser.json' exists in the current directory.")
print(" Have you logged in to YTMusic? Run 'ytmusicapi browser' to login")
sys.exit(1)
try:
return YTMusic("browser.json")
except json.decoder.JSONDecodeError as e:
print(f"ERROR: JSON Decode error while trying start YTMusic: {e}")
print(" This typically means a problem with a 'browser.json' file.")
print(" Have you logged in to YTMusic? Run 'ytmusicapi browser' to login")
sys.exit(1)
Phew! Can't help but feel it would be in Google's best interest to offer this sort of import functionality, but they're probably got some agreement with Spotify or something. Again, so many thank yous! |
Damn. Just noticed this: #125 (comment) |
Oh wow, I didn't notice it either. |
Don't have much of an output to show you since I tried to fix this and lost all output from the failure. A bit of tinkering is required. OAuth used was not working for me. Browser authentication worked for me. Just creating this issue so that others who come across this will know what to do.
Create a .py file within your env (if you got one) and then write the ytmusicapi.setup code mentioned here:
https://ytmusicapi.readthedocs.io/en/stable/setup/browser.html
I was on a MAC so I ran the code like this:
pbpaste "raw-request-header-from-a-POST-200-request" | python3 -m yt_browser_auth
Make sure the cookie section of your header has something like this in it "__Secure-3PAPISID="
This should create a browser.json file. Now Navigate to backend.py and under "def get_ytmusic", change the oauth.json to whatever you named your json file to when running the previous script.
Is all. Happy sailing!
The text was updated successfully, but these errors were encountered: