kotlinYtmusicScraper hard-codes X-Goog-Authuser: 0, brand channels of a non-first Google account load the wrong library
Duplicate Check
- [x] I confirm I searched for existing reports and found no duplicates.
Describe the Bug
Desktop login (cookie pasted from the browser): if the browser session has more than one Google account signed in, selecting a brand channel that belongs to a non-first account makes the app silently fall back to the first account's data. Library, liked songs and subscriptions shown are those of the wrong channel, even though the account picker shows the right one.
Cause (verified with direct calls to youtubei/v1/browse and account/account_menu using the cookie the app stored): kotlinYtmusicScraper always sends X-Goog-Authuser: 0 (hard-coded in Ytmusic.ytClient). The brand channel's X-Goog-Pageid belongs to authuser=1, so YouTube answers the request as not signed in ("Accedi" / "Sign in" placeholders, 0 liked songs). Same request with X-Goog-Authuser: 1 + the same pageId returns the correct channel and its 26 liked songs.
getAccountSwitcherEndpoint already returns, for each channel, a signinUrl containing the right authuser=N, so the fix is to store that value alongside pageId and send it instead of the constant 0.
Workaround: log out, export the cookie from a browser session where only that Google account is signed in.
Steps to Reproduce
- In the browser, sign in to two Google accounts; the second one owns a brand channel.
- In SimpMusic desktop, paste the cookie and pick the brand channel in the account list.
- Library / Liked / Subscriptions show the first account's content.
Expected Behavior
Selecting a channel should show that channel's library.
App Version
2.1.0 (desktop, AppImage)
Android Version
N/A - CachyOS (Arch), GNOME Wayland
Device Model
Laptop
Custom ROM
- [ ] I am using a custom ROM
Custom ROM Name (if applicable)
No response
Screenshots (optional)
No response
Log / Error Details
account/account_menu with the stored cookie and pageId:
X-Goog-Authuser: 0 + X-Goog-Pageid: <brand> -> 'Passa a Music Premium' / 'Accedi' (not signed in), liked: 0
X-Goog-Authuser: 1 + X-Goog-Pageid: <brand> -> 'Me_Xico', liked: 26
X-Goog-Authuser: 0, no pageId -> first account's main channel, liked: 5
Follow-up on this one: reviewing the merged change I noticed the fix is only partial.
cookie, pageId and authUser are written to DataStore in one edit but were pushed to
the scraper by three independent collectors, and inside Ytmusic they were three separate
vars read one by one while building headers. So a request built right after an account
switch could still go out with the new pageId and the previous authuser (or cookie),
just for a short window instead of always. PR on core coming shortly: one flow over the
DataStore snapshot and one immutable session object in the scraper.