Most of Spotify’s public data — metadata, cover art, the 30-second preview — needs no account at all. Lyrics are the exception. The web player only shows them once you’re signed in, so to read them in a script you authenticate as yourself.
The one catch: your sp_dc cookie
You hand SpotifyScraper the same cookie that keeps you logged into open.spotify.com in your browser, and it reads the lyrics on your behalf — locally, nothing leaving your machine:
from spotify_scraper import SpotifyClient
client = SpotifyClient(cookies={"sp_dc": "YOUR_SP_DC_COOKIE"})
lyrics = client.get_lyrics("https://open.spotify.com/track/4uLU6hMCjMI75M1A2tKUQC")
print(lyrics)
cookies takes either a dict like {"sp_dc": "..."} or a path to a Netscape cookies.txt file if you’ve exported one from the browser:
client = SpotifyClient(cookies="cookies.txt")
When Spotify provides them, the lyrics come back time-synced — each line tied to a timestamp — so you can line them up with playback.
Where the cookie comes from (and keep it secret)
sp_dc is the session cookie for your logged-in account. Open open.spotify.com signed in, then your browser’s devtools → Application / Storage → Cookies → copy the sp_dc value. Because it is your session, treat it like a password — keep it out of source control and out of logs. An environment variable is the easy right answer:
import os
client = SpotifyClient(cookies={"sp_dc": os.environ["SP_DC"]})
The honest part
This isn’t a backdoor. It’s you, reading what you’re already allowed to see when you’re logged in — just scriptable. The cookie stays on your machine and authenticates the same request the web player makes.
Two honest caveats worth stating plainly: it’s your own session, so don’t share the cookie or hammer the endpoint; and lyrics are licensed content (Spotify pays a provider for them). Reading them for yourself or for research is a world away from republishing them — don’t redistribute. As with the rest of the library, it’s an unofficial reader of data the web player already shows you, not affiliated with Spotify.
If that’s what you need: pip install spotifyscraper, try the live demo, or read the source on GitHub.