
Spotifyscraper
io.github.AliAkhtari78由 GitHub 帳號 AliAkhtari78 發布v3.9.2更新於 Oct 24, 2026
Public Spotify metadata, lyrics and podcasts for LLM agents. No API key, read-only.
概覽
非官方 Spotify 擷取 MCP 伺服器,讓助理查詢公開的曲目、專輯、藝人、播放清單、節目與單集,搭配 Cookie 還可取得歌詞。
- 可以做什麼
- 搜尋 Spotify,並依連結、URI 或 ID 取得曲目、專輯、藝人、播放清單、節目與單集
- 查看排行榜、相關藝人、完整作品清單、推薦、製作人員、演出活動與公開使用者資料
- 取得封面圖、試聽片段、封面配色與 Canvas 影片
- 在提供 Cookie 時取得時間軸同步的歌詞與播客逐字稿,並查看已登入帳號資訊
- 批次查詢,每個輸入各回傳一筆結果,個別失敗不影響其餘
- 適用情境
- 適合助理需要 Spotify 中繼資料、搜尋結果、歌詞或播客逐字稿,但不想註冊 Spotify 應用程式或申請 API 金鑰的情境,例如音樂資料調查、播放清單摘要或播客筆記。
- 執行需求
- 以本機 Python 套件形式執行(需 Python 3.10+),安裝時加上 mcp 附加元件;選用附加元件提供媒體嵌入、Playwright 瀏覽器登入與系統鑰匙圈儲存。公開資料無需帳號。需要登入的工具依賴 SPOTIFY_SP_DC Cookie,透過環境變數傳入。需要能連線至 Spotify 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Spotifyscraper,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
SpotifyScraper
[Live demo] [PyPI version] [Python versions] [Downloads] [CI] [Docs] [Container] [Maintained with Claude Code] [License: MIT] [GitHub stars]
Extract public Spotify data — tracks, albums, artists, playlists, and podcasts — without the official API or an API key.
🎧 Try it live in your browser → — paste any Spotify link and watch SpotifyScraper pull typed data, cover art, and a preview, with the exact Python that does it. (How it was built.)
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. Public data needs no login; the opt-in logged-in features
(lyrics, podcast transcripts, and account info) add your own Spotify sp_dc
cookie — never a password or an API key.
Upgrading from v2? See the migration guide. The previous line lives on the
v2.xbranch.
SpotifyScraper vs. the official API (spotipy)
spotipy wraps Spotify's official Web API — the right choice when you need to
write to a user's account or read private/library data. SpotifyScraper reads the
public data the web player already exposes, so it skips the setup entirely.
Use spotipy for authenticated writes and private, market-accurate data; use SpotifyScraper for fast, key-free access to public metadata, lyrics, and previews — plus a drop-in MCP server for AI agents.
Hit by the official-API deprecations? Spotify's
audio-features,recommendations, andrelated-artistsendpoints have returned403for new apps since Nov 2024. SpotifyScraper still returns related artists and recommendations with no API key. (It can't bring backaudio-features— Spotify removed that data entirely, from every tool.)
Install
Python 3.10+.
Quickstart
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
Download a cover and preview
Localized display names
Pass locale — a BCP-47 language tag: a bare language subtag ("de",
"ja") or a language-region tag ("ja-JP") — to localize the language of
display names. Set it per client or override it per call:
It is sent as the Accept-Language header and changes only how names are
spelled. It is not a country/market code — a bare "US" is meaningless as
a language and is ignored — and it does not filter regional availability
or vary preview URLs: anonymous Spotify resolves country from the request IP,
and its pathfinder silently ignores a market variable. True market/availability
filtering requires the authenticated Web API, which this library does not
implement; for region-specific results, point the client's proxy at the target
region. See the
localization guide.
Features
- All core entities + podcasts — tracks, albums, artists, playlists, shows, episodes.
- Search across every entity type, returning one typed
SearchResults. - Charts & discovery — editorial charts, related artists, full paginated discography, and album recommendations.
- Cover colors & Canvas — extract an artwork's theming palette and download a track's looping Canvas video.
- Credits & concerts — performers/writers/producers and an artist's upcoming live events.
- Public user profiles —
get_user()(name, follower counts, public playlists). - MCP server — expose everything to Claude/LLMs via
spotifyscraper-mcp(batch tools + a one-callget_track_visuals); also ships as a container on ghcr.io. - Localized display names — pass a BCP-47 language tag (
locale) to set the language of names. - Lyrics & podcast transcripts — cookie-authenticated, time-synced, one token for both.
- Browser-assisted login + session persistence — log in once, then run headless (no stored passwords).
- Account-aware —
get_account()/is_premium(), plus cookie-freesession_info(). - Batch helpers — plural
get_*s([...])with partial-failure-safe results and managed concurrency. - 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. - Optional response cache — opt-in, persistent, token-safe (only token-free pathfinder GETs).
- Anti-ban built in — per-host rate limiting, retries with backoff, UA rotation, proxies.
- Browser fallback via Playwright when you need a real browser.
Command line
With the cli extra installed, a spotifyscraper command is available:
Every command emits JSON, so it composes with tools like jq. See the
CLI guide.
Batch helpers
Each getter has a plural sibling (get_tracks, get_albums, …) that fetches
many inputs and returns one BatchItem per input — index-aligned, and a dead
input never aborts the rest:
The async client runs them concurrently, bounded by max_concurrency (default
5). See the batch guide.
Response caching
For repeated lookups, enable an opt-in persistent cache. It only stores token-free pathfinder responses — never the embed pages that carry the anonymous token — so no credential is ever written to disk:
Default TTL is 24h; the FileCache is stdlib-only and the backend is pluggable.
See the caching guide.
Search
search() runs one anonymous, aggregate query across every entity type and
returns a typed SearchResults:
Hits are sparse (pass an id to get_album()/get_show() for the full entity);
total is the track-match count. See the
search guide.
Lyrics & transcripts
Lyrics and podcast transcripts need a Spotify account cookie (sp_dc); the
library handles the token handshake for you, and one cookie powers both:
Your cookie is sent only to Spotify and never logged. An episode with no
transcript raises NotFoundError. See the
lyrics & cookies guide.
Browser-assisted login
Don't want to copy a cookie by hand? login() opens a real browser, you sign in
once, and the captured sp_dc is persisted (no password is ever collected or
stored). Later runs reconnect headlessly — ideal for servers:
login() reuses a valid saved session by default (browser only the first time);
from_saved_session() never needs the browser extra. The cookie is stored in
an owner-only file, or the OS keyring with store="keyring" (the keyring
extra). get_account()/is_premium() report the logged-in account, and
SpotifyClient.session_info() checks a saved session without exposing the
cookie. See the
authenticated sessions guide.
Roadmap
Shipped
What's next — future ideas are tracked in the GitHub milestones and issues — 👍 or weigh in on the ones that matter most to you. Scope is subject to change.
Reliability & maintenance
This library rides Spotify's own public endpoints, so it can break when Spotify changes them. To keep it dependable:
- A daily canary runs the live test suite against Spotify. When an endpoint
shifts, it automatically opens a
spotify-breakageissue (and closes it on recovery), so regressions surface before they reach you. - Breakages are triaged and fixed promptly with the help of Claude Code
(Anthropic's coding agent), under the maintainer's review — the same
agent-assisted workflow that keeps this project moving. Persisted-query hashes
live in a single file (
api/pathfinder.py), so a Spotify rotation is a one-line update. - Every change runs through
ruff+mypy --strict+ a hermetic test suite (85% coverage floor) across Python 3.10–3.13 on Linux, macOS, and Windows.
If something is broken for you, please open an issue — the monitoring has often caught it already.
Documentation
Full docs, guides, and the API reference: https://spotifyscraper.readthedocs.io
The MCP server also ships as a container:
docker run -p 8000:8000 ghcr.io/aliakhtari78/spotifyscraper (set SPOTIFY_SP_DC
to enable the authenticated tools).
Legal
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/.
Star history
If SpotifyScraper saved you the official-API OAuth dance, a ⭐ helps other developers find it — and tells me which features to keep building.
[Star history of AliAkhtari78/SpotifyScraper]License
MIT © Ali Akhtari — full-stack AI engineer (aliakhtari.com).
來源:README.md,提交 9cbf05a
工具
0版本歷史
1- v3.9.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
