-
-
Notifications
You must be signed in to change notification settings - Fork 221
-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
The account_index
parameter does not work
#735
Labels
bug
Something isn't working
Comments
To obtain the account index in the browser, the const activeHandle = window.ytInitialData.header.playlistHeaderRenderer.ownerText.runs[0].navigationEndpoint.commandMetadata.webCommandMetadata.url.slice(1)
const youtube = await Innertube.create({
cookie: document.cookie,
fetch: (...arguments_) => fetch(...arguments_),
})
const response = await youtube.session.http.fetch(`/getAccountSwitcherEndpoint`, {
baseURL: 'https://www.youtube.com',
})
const text = await response.text()
const accountSwitcher = JSON.parse(text.slice(5))
const accounts = accountSwitcher.data.actions[0].getMultiPageMenuAction.menu.multiPageMenuRenderer.sections[0].accountSectionListRenderer.contents[0].accountItemSectionRenderer.contents
return accounts.findIndex(item => item.accountItem && item.accountItem.channelHandle.simpleText === activeHandle) |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
In most cases, it is required to remove these lines:
YouTube.js/src/utils/HTTPClient.ts
Lines 75 to 76 in 4b60b97
To prevent this response from
/playlist
requests:Failure Logs
Expected behavior
The playlist contents will be retrieved from the secondary account.
Current behavior
The
X-Goog-AuthUser
header doesn't appear to indicate the active account as described in #229 and yt-dlp/yt-dlp@3491707.Looking at the source of desktop_polymer.js, the
X-Goog-AuthUser
header comes from theSESSION_INDEX
value:Switching between accounts does not change the
ytcfg.data_.SESSION_INDEX
value, it is always0
. A search on GitHub only found code using theSESSION_INDEX
value or hard coding0
or1
.Version
Default
Anything else?
This code successfully gets the contents of the Watch Later playlist of the active account:
Checklist
The text was updated successfully, but these errors were encountered: