mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-25 15:26:01 +03:00
[GH-ISSUE #409] Update Chrome authentication documentation #310
Labels
No labels
a/b
bug
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
yt-error
yt-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ytmusicapi#310
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Onyenso on GitHub (Jul 14, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/409
I tried to create a new playlist using
YTMusic.create_playlist()but it returns a 401 Unauthorized. Before this, I had already set up authentication using thesetup()function. My authentication file has the right credentials as copied from my browser. When I callYTMusic.create_playlist(), I get the 401 error. Traceback:Steps to reproduce the behavior:
ytmusicapi.setup()method, passing in the right headers.YTMusic.create_playlist()While trying to copy my request headers from my Chrome browser, I noticed that the usual structure of the text has changed from the last time I copied (a couple months ago.) So I just copied my cookie value and used it in my authentication file as described here. You might want to update the documentation at https://ytmusicapi.readthedocs.io/en/latest/setup/browser.html#copy-authentication-headers for Chrome browsers.
@sigma67 commented on GitHub (Jul 20, 2023):
Can you be more specific what is not working for you when creating the credentials from Chrome?
@Onyenso commented on GitHub (Jul 20, 2023):
About the credentials on Chrome, the structure of the text has been changed. The screenshot shows what it looks like now. Also, what is the update on the 401 Unauthorized error? I'm sure I created my header file and passed it into

setup(), but I kept getting the error when I try to create a palaylist.@Onyenso commented on GitHub (Jul 25, 2023):
I did a temporary fix. So the reason I was getting the 401 error was because the implementation for

setup_browserinytmusicapi.auth.browserno longer works for this new text format. Hence, it couldn't correctly parse the header text that is copied from Chrome. I did this instead and I was able to create a new header file. I don't know if this will work for the header text from other browsers:@sigma67 commented on GitHub (Aug 4, 2023):
I mean the docs state the following:
I presume you copied some of the headers starting with the colon, that's why you got the error?
But I agree that we should probably raise an Exception in this case instead of letting the user run blindly into the 401.
@sigma67 commented on GitHub (Aug 4, 2023):
PR welcome.
@sigma67 commented on GitHub (Aug 20, 2023):
I found the issue. For whatever reason, Chrome now copies key and value as separate lines.