AliAkhtari78/SpotifyScraper

Extract public Spotify data — tracks, albums, artists, playlists, podcasts & lyrics — without the official API. Sync + async, typed models, one dependency.

288 ★32 forksPythonUpdated 2d ago

What you need to know

Unofficial Python library plus MCP server that extracts public Spotify data (tracks, albums, artists, playlists, shows, episodes, podcasts) without the official API or an API key, by bootstrapping an anonymous token from Spotify's public embed pages and reading the same JSON endpoints as the web player.

Install

pip install spotifyscraper
pip install "spotifyscraper[mcp]"   # + MCP server for LLM hosts
pip install "spotifyscraper[media]"  # + cover/preview embedding (mutagen)
pip install "spotifyscraper[browser]" # + Playwright browser fallback & login
pip install "spotifyscraper[all]"
docker run -p 8000:8000 ghcr.io/aliakhtari78/spotifyscraper   # containerized MCP server

Usage

  • Python: `with SpotifyClient() as client: track = client.get_track("https://open.spotify.com/track/<id>")` — every entity has get_track/get_album/get_artist/get_playlist/get_episode/get_show accepting a URL, URI, or bare ID.
  • Search: `client.search("daft punk", types=("track", "artist"), limit=5)` returns a typed SearchResults.
  • Lyrics/podcast transcripts: pass a `sp_dc` cookie (`SpotifyClient(cookies="cookies.txt")`) or use `client.login()` browser-assisted login; `get_lyrics()` / `get_transcript()`.
  • MCP: expose everything to Claude/LLMs via the `spotifyscraper-mcp` server (batch tools + one-call `get_track_visuals`); set SPOTIFY_SP_DC env to enable authenticated tools.

Key features

  • No API key / app registration / OAuth needed for public data — skips spotipy-style setup entirely.
  • Sync and async clients sharing one sans-io core; typed, frozen models with JSON-safe to_dict()/from_dict().
  • Search, charts & discovery (editorial charts, related artists, paginated discography, recommendations), cover colors & Canvas videos, credits & concerts, public profiles.
  • Cookie-authenticated lyrics and podcast transcripts (one token for both), browser-assisted login with session persistence.
  • MCP server for Claude/LLM agents plus batch helpers (plural get_*s, partial-failure-safe), response cache, anti-ban (rate limiting, retries, UA rotation, proxies).

Best for

Fast, key-free access to public Spotify metadata, lyrics, and previews for AI agents / MCP-enabled LLMs, or as a drop-in alternative to spotipy when OAuth/quota is prohibitive.

Caveats

  • Unofficial, independent project not affiliated with Spotify; rides Spotify's public endpoints so it can break when they change (a daily canary monitors and opens breakage issues).
  • Read-only public data only — no write/playback/private data (that's what the official spotipy API is for); does not download full tracks or circumvent DRM.
  • Lyrics and podcast transcripts require a Spotify account `sp_dc` cookie; market/availability filtering is not supported (locale is a language tag only, not a country code).
  • Spotify's audio-features data was removed entirely; recommendations/related-artists still work without a key.
  • Use for educational and personal purposes and in line with Spotify's Terms of Service.
Platforms: Linux · macOS · WindowsClients: Claude · LLM agents (MCP)
Documentation ↗

Reviewed 2026-08-07

Topics

asyncclaudehttpxllmlyricsmcpmcp-servermetadatamodel-context-protocolmusicno-api-keypodcastpythonscraperspotifyspotify-apispotify-lyricsspotify-scraperspotify-web-playerweb-scraping
View on GitHub ↗
Stars
288★
Forks
32
Language
Python
License
MIT
Created
2020-04-28
Last push
2026-08-05