-
Notifications
You must be signed in to change notification settings - Fork 273
Description
- I confirm that I have read the FAQ
Describe the bug
When pasting request headers from Chrome (even though Firefox is recommended), the authentication process fails with:
ytmusicapi.exceptions.YTMusicUserError: The following entries are missing in your headers: x-goog-authuser. Please try a different request (such as /browse) and make sure you are logged in.
The reason this happens is because starting sometime early last year, Chrome request headers are copied to your clipboard without a colon at the end of each key. For example:
accept
*/*
accept-encoding
gzip, deflate, br, zstd
accept-language
en-US,en;q=0.9
This breaks the parser in browser.py:setup_browser.
I've been working on a solution but it's a bit tricky since now the header keys and header values don't have any distinguishing characteristics from each other -- you kind of just have to assume the first line is a key and the 2nd line is a value and go from there.
References:
- Closed ticket from 2023 that fixed Chrome headers when they used to have colons: Update Chrome authentication documentation #409
- Discussion on this I opened last year: Chrome no longer works for browser authentication #793
- Fix I implemented in my own project last year before I knew about issue 409 : https://github.com/apastel/ytmusic-deleter/blob/56726397b849d523d16de1e8799036e7a6133b4c/ytmusic_deleter/common.py#L94
We could port over that fix to ytmusicapi but I'm not super proud of it. I would rather start with the existing fix that uses chrome_remembered_key and modify that instead. I started to work on something but so far it's not quite working yet.
ytmusicapi version
1.11.4
To Reproduce
Steps to reproduce the behavior:
- Follow instructions to paste request headers, use Chrome instead of Firefox
- Observe error in terminal.