YT Music: webbläsar-headers som primär koppling (TV-OAuth ger HTTP 400 hos youtubei)
All checks were successful
build-and-push / build (push) Successful in 19s

Alla autentiserade ytmusicapi-anrop med TV-OAuth-token får 400 'invalid
argument' — känd Google-begränsning. Ny väg: klistra in request-headers
från inloggad music.youtube.com i settings → POST /api/ytmusic/headers
bygger ytmusicapi-kompatibel browser.json i Youtubarrs datamapp.
Youtubarr-forken föredrar browser.json framför oauth.json. Testern
rapporterar header-kopplingen. 2 nya tester, totalt 33.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01824ZrvG2mDYYrmwqypLNup
This commit is contained in:
2026-08-01 05:35:06 +02:00
parent dcd4928813
commit 07264be338
5 changed files with 119 additions and 2 deletions

View File

@@ -87,3 +87,23 @@ test('poll: avslag ger felstatus', async () => {
})
assert.deepEqual(await flow.poll('dev-123'), { status: 'error', message: 'nekad' })
})
test('saveBrowserHeaders: bygger browser.json av råa headers', () => {
const { dataDir, store, config } = setup()
const flow = ytmusicFlow({ config, store })
const out = flow.saveBrowserHeaders(
'POST /youtubei/v1/browse HTTP/2\nUser-Agent: TestUA/1.0\nAccept-Language: sv\nX-Goog-AuthUser: 0\nCookie: VISITOR=1; __Secure-3PAPISID=hemlis; PREF=x\n',
)
assert.deepEqual(out, { ok: true })
const b = JSON.parse(readFileSync(path.join(dataDir, 'browser.json'), 'utf8'))
assert.equal(b['User-Agent'], 'TestUA/1.0')
assert.match(b.Cookie, /__Secure-3PAPISID/)
assert.equal(b['x-origin'], 'https://music.youtube.com')
})
test('saveBrowserHeaders: avvisar headers utan giltig cookie', () => {
const { store, config } = setup()
const flow = ytmusicFlow({ config, store })
assert.match(flow.saveBrowserHeaders('User-Agent: x').error, /Cookie/i)
assert.match(flow.saveBrowserHeaders('Cookie: bara=skräp').error, /__Secure-3PAPISID/)
})