You don’t always have a link to start from. Sometimes you have a name and you want the thing. The official API can search, but only after you’ve registered an app and run OAuth. The web player searches the moment you start typing — anonymously — and SpotifyScraper reads that same tier.
A search in a few lines
from spotify_scraper import SpotifyClient
with SpotifyClient() as client:
hits = client.search("daft punk", types=("track", "artist"), limit=5)
print(hits.tracks[0].name)
print(hits.artists[0].name)
types decides what comes back, and limit caps each kind. Results are typed objects, not raw JSON you have to spelunk — hits.tracks and hits.artists are lists of records with .name and .artists already parsed.
Find, then fetch
Search is for finding — it gives you enough to know which result you meant. When you want the full record — the preview, the cover, every field — hand that track to get_track and read it properly:
with SpotifyClient() as client:
hits = client.search("one more time", types=("track",), limit=1)
top = hits.tracks[0]
print("found:", top.name, "—", top.artists[0].name)
It’s the same two-step a person does without thinking: search, recognise the right one, open it.
Be a good citizen
Search hits the same servers a browser does, so the courtesies are the same: keep limit to what you’ll use, cache results you’ll need again, and don’t loop a thousand queries a second. None of it is behind the official API’s per-app rate limits — which is exactly why it’s worth not abusing.
The honest part
This reads public search results, the same ones the web player shows — for lookups, tooling, and research. It’s an unofficial reader of public data, not affiliated with Spotify, and it doesn’t reach anything private.
Try the live demo, then pip install spotifyscraper or read the source on GitHub.