Skip to main content

SpotifyScraper

PyPI version Python versions CI Docs License: MIT

Extract public Spotify data — tracks, albums, artists, playlists, and podcasts — without the official API or any credentials.

SpotifyScraper bootstraps an anonymous token from Spotify's own public embed pages and reads the same JSON endpoints the web player uses, returning typed, immutable models. v3 is a ground-up rewrite focused on reliability and a clean, modern API.

Upgrading from v2? See the migration guide. The previous line lives on the v2.x branch.

Install

pip install spotifyscraper                 # core (only depends on httpx)
pip install "spotifyscraper[media]"        # + cover/preview embedding (mutagen)
pip install "spotifyscraper[browser]"      # + Playwright browser fallback
pip install "spotifyscraper[all]"          # everything

Python 3.10+.

Quickstart

from spotify_scraper import SpotifyClient

with SpotifyClient() as client:
    track = client.get_track("https://open.spotify.com/track/4uLU6hMCjMI75M1A2tKUQC")
    print(track.name, "—", track.artists[0].name)
    print(track.duration_ms, "ms |", track.preview_url)

    print(track.to_dict())          # JSON-safe dict, if you prefer dicts

Every entity has its own method — get_track, get_album, get_artist, get_playlist, get_episode, get_show — each accepting a URL, URI, or bare ID.

Async

import asyncio
from spotify_scraper import AsyncSpotifyClient

async def main():
    async with AsyncSpotifyClient() as client:
        track, album = await asyncio.gather(
            client.get_track("4uLU6hMCjMI75M1A2tKUQC"),
            client.get_album("4aawyAB9vmqN3uQ7FjRGTy"),
        )
        print(track.name, "|", album.name)

asyncio.run(main())

Download a cover and preview

from spotify_scraper import SpotifyClient

with SpotifyClient() as client:
    track = client.get_track("4uLU6hMCjMI75M1A2tKUQC")
    client.download_cover(track, dest="covers/")
    client.download_preview(track, dest="previews/", embed_cover=True)  # needs [media]

Features

  • All core entities + podcasts — tracks, albums, artists, playlists, shows, episodes.
  • Sync & async clients sharing one sans-io core.
  • Typed, frozen models with JSON-safe to_dict() / from_dict().
  • Two-tier resilience — Spotify's GraphQL API with automatic fallback to the embed page.
  • One core dependency (httpx); media and browser support are optional extras.
  • Anti-ban built in — per-host rate limiting, retries with backoff, UA rotation, proxies.
  • Browser fallback via Playwright when you need a real browser.

Roadmap

Version Scope
3.0 The library: all entities, pagination, media downloads, browser fallback, docs
3.1 Command-line interface and cookie-authenticated lyrics

Documentation

Full docs, guides, and the API reference: https://spotifyscraper.readthedocs.io

SpotifyScraper is an unofficial, independent project, not affiliated with Spotify. It reads publicly available data and the ~30-second previews Spotify publishes; it does not download full tracks or circumvent DRM. Use it for educational and personal purposes, and in line with Spotify's Terms of Service. See the legal notice.

Contributing

Contributions are welcome — see CONTRIBUTING.md. The project is developed spec-first with OpenSpec; specs live in openspec/.

License

MIT © Ali Akhtari

Metadata

Release files for spotifyscraper 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotifyscraper 3.0.0
File Size Uploaded
spotifyscraper-3.0.0.tar.gz 276.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spotifyscraper 3.0.0
File Interpreter ABI Platform
spotifyscraper-3.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 330.5 kB

Release files / spotifyscraper-3.0.0.tar.gz

Download URL spotifyscraper-3.0.0.tar.gz
Size 276.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1d447e32ee6cbf4a9d627c91a245e06a32a45810a49ddb1350e3827e34d5b7a7
BLAKE2b-256 checksum
How to use checksums
fbf147ea34f95e7f7aed891b1a31bbe240634c4b748fb36036ed60fbf870d51b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / spotifyscraper-3.0.0-py3-none-any.whl

Download URL spotifyscraper-3.0.0-py3-none-any.whl
Size 54.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0077a9100c2003fb588abc9e51c42600ea327ec54aad5aff4ce5a4ed4412a5be
BLAKE2b-256 checksum
How to use checksums
0bb44f8a738911d795492fe2980f68af9f22094852aacc3b5c5f354c9b1103a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

3.9.2

2 release files

3.9.1

2 release files

3.9.0

2 release files

3.8.0

2 release files

3.7.0

2 release files

3.6.1

2 release files

3.6.0

2 release files

3.5.0

2 release files

3.4.0

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

This release

3.0.0 This release

2 release files

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.20

2 release files

2.0.19

2 release files

2.0.18

2 release files

2.0.15

2 release files

2.0.14

2 release files

2.0.13

2 release files

2.0.12

2 release files

2.0.11

2 release files

2.0.10

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page