Signing in
Search, radio, playlists by ID and lyrics need no credentials at all. Only your own library — playlists, liked songs, liking tracks — does.
ytkew --auth browser # lifts an existing Firefox loginytkew --auth cookie # paste a Cookie header from any browserytkew --auth oauth # Google Cloud "TVs and Limited Input devices" clientFrom the browser
Section titled “From the browser”--auth browser reads the YouTube cookies straight out of your Firefox
profile, so signing in at music.youtube.com is all the setup there is.
It searches native, snap and flatpak Firefox plus LibreWolf, Waterfox and Zen. It reads a snapshot rather than the live database, since Firefox keeps it open in WAL mode; deletes that snapshot afterwards; and checks the cookies against the API before writing anything.
Chromium is not supported. It encrypts cookie values with a key held in the
desktop keyring, which needs both a keyring client and AES-GCM to undo — a
different job. Use --auth cookie instead.
Pasting a header
Section titled “Pasting a header”- Open music.youtube.com, signed in.
- Open devtools and pick any request to
music.youtube.com. - Copy the whole
Cookierequest header. - Run
ytkew --auth cookieand paste it.
It is validated against the API before it is saved, so a bad paste fails immediately rather than looking fine until you open your library.
--auth oauth runs a device flow, but needs a Google Cloud OAuth client of
type TVs and Limited Input devices, which you have to create yourself. Its
tokens also expire and are refreshed on load. Cookie auth is easier and does
not expire on a timer.