SpotipyFree
A lightweight drop-in replacement for Spotipy without using the spotify api. This project was build because spotify removed access to its API for non-premium users. This project doesn't use ANY Spotify APIs.
Features
- Search the catalog and retrieve track, album, artist, and playlist data.
- With an authenticated account, inspect saved tracks, playlists, profile, and playback state, and issue basic playback controls.
- Optionally expose client methods through a local Flask HTTP server.
Catalog lookups are available without signing in. Account and playback features use an authenticated session; see the examples and real-world uses and authentication guide.
Install
python -m pip install spotipyFree
Requires Python 3.9 or newer.
Examples
Search for tracks
from spotipyfree import Spotify
spotify = Spotify()
results = spotify.search("Blinding Lights The Weeknd")
for track in results["tracks"]["items"]:
artists = ", ".join(artist["name"] for artist in track["artists"])
print(f"{track['name']} - {artists}")
Get a track from its Spotify URL
track_url = "https://open.spotify.com/track/67Hna13dNDkZvBpTXRIaOJ"
track = spotify.track(track_url)
artists = ", ".join(artist["name"] for artist in track["artists"])
print(f"Name: {track['name']}")
print(f"Artists: {artists}")
print(f"Duration: {track['duration_ms'] / 1000:.0f} seconds")
print(f"Spotify URL: {track['external_urls']['spotify']}")
Get an album and list its tracks
album_url = "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa"
album = spotify.album(album_url)
print(f"Album: {album['name']}")
print("Artists:", ", ".join(artist["name"] for artist in album["artists"]))
tracks = spotify.album_tracks(album_url)
for track in tracks["items"]:
print(f"{track['track_number']}. {track['name']}")
Get an artist and browse their albums
artist_url = "https://open.spotify.com/artist/3Bd1cgCjtCI32PYvDC3ynO"
artist = spotify.artist(artist_url)
print(f"Artist: {artist['name']}")
albums = spotify.artist_albums(artist["id"], include_groups="album,single")
for album in albums["items"]:
print(album["name"])
Read a playlist
playlist_url = "https://open.spotify.com/playlist/6lnfkAgnVtNzvj8KScLSkj"
playlist = spotify.playlist(playlist_url)
print(f"Playlist: {playlist['name']}")
for item in spotify.playlist_items(playlist_url)["items"]:
track = item["track"]
artists = ", ".join(artist["name"] for artist in track["artists"])
print(f"{track['name']} - {artists}")
Read account and playback information
Account features require an authenticated session. The first login may prompt you to import a session; see the authentication guide.
if not spotify.login():
raise RuntimeError("Could not load an authenticated session")
print("Signed in as:", spotify.me()["display_name"])
saved_tracks = spotify.current_user_saved_tracks()
for item in saved_tracks["items"]:
track = item["track"]
print(track["name"], "-", ", ".join(a["name"] for a in track["artists"]))
playback = spotify.current_playback()
print("Now playing:", playback["name"])
Control playback
Playback controls act on your authenticated active player:
spotify.pause_playback()
spotify.start_playback() # Resume
spotify.next_track()
spotify.previous_track()
spotify.seek_track(position_ms=30_000)
See the usage guide for more examples.
Build and preview the documentation
Install the documentation tools and build the HTML site from the repository root:
python -m pip install -r docs/requirements.txt
python -m sphinx -W -b html docs build/docs
On Windows, the build output is in build\docs. Open
build\docs\index.html in a browser, or serve it locally:
python -m http.server 8000 --directory build/docs
Then visit http://localhost:8000.
Documentation
- Read the documentation
- Installation and quick start
- Usage guides
- Examples and real-world uses
- Legal, privacy, and security considerations
License
This project is licensed under the MIT License. See LICENSE.
Metadata
Release files for spotipyFree 1.9.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spotipyfree-1.9.15.tar.gz | 18.4 kB | Without provenance | Details for spotipyfree-1.9.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spotipyfree-1.9.15-py3-none-any.whl | Python 3 | none | any | Details for spotipyfree-1.9.15-py3-none-any.whl |
Total release size: 37.8 kB
Release files / spotipyfree-1.9.15.tar.gz
| Download URL | spotipyfree-1.9.15.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a5cee7e2786d1aa353068f08f0d06bdf46a442e2efcc7f2164a533cf8ec0685
|
|
BLAKE2b-256 checksum How to use checksums |
d105a41699d6b6c400039044459817c1fb90a06d9074428e4330163edc4aeea6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / spotipyfree-1.9.15-py3-none-any.whl
| Download URL | spotipyfree-1.9.15-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7304defb5e35d98403f0bdc6e5715bf9e0fe605eddb77403c05303c42e3ad55
|
|
BLAKE2b-256 checksum How to use checksums |
946bcceb6c46ca18089a624a01c3dfa089be94222a149efe0b70a11a7a057f61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for spotipyFree 1.9.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.