Skip to main content

Python library and CLI for Spotify data

Project description

pyspoti

An interactive terminal browser for Spotify.

Search artists, albums, and tracks — then navigate between them with a menu-driven UI. Album covers display inline on supported terminals.

Install

Requires Python 3.12+.

uv tool install pyspoti
# or
pip install pyspoti

For local development:

git clone https://github.com/gabriel-jung/pyspoti.git
cd pyspoti
uv sync

Requires a Spotify application with Client Credentials. Add the following to your ~/.zshrc or ~/.bashrc:

export SPOTIFY_CLIENT_ID="your_client_id"
export SPOTIFY_CLIENT_SECRET="your_client_secret"

Alternatively, place a .env file with the same variables in the directory where you run the command.

Usage

Search

spotify Summoning                        # search all categories
spotify --artist Summoning               # artists only
spotify --album "Minas Morgul"           # albums only
spotify --track "Long Lost to Where"     # tracks only

Filters

spotify --genre "black metal"            # search by genre
spotify --genre "black metal" --year 2024  # genre + year
spotify --album --label "Season of Mist"   # albums by label
spotify --new                            # albums from the last two weeks
spotify --new --hipster                  # recent low-popularity albums

Interactive navigation

After selecting a result, you enter an interactive browser:

  • Artists — view top tracks, browse discography, select an album to see its tracklist, select a track to see details and navigate to its artist or album.
  • Albums — header with tracklist, select a track or navigate to the artist.
  • Tracks — header with details, navigate to artist or album.

Press 0 to go back, Ctrl+C to quit.

Output modes

spotify --artist Summoning --json   # output as JSON
spotify --artist Summoning --full   # all sections at once, no interaction
spotify -v ...                      # enable debug logging

Terminal images

Album covers and artist images render inline on terminals that support the iTerm2 or Kitty image protocol (iTerm2, Kitty, WezTerm, Mintty).

Library

The core module has no terminal dependencies — use it in scripts, pipelines, or other tools. All data is returned as plain dicts with a _type discriminator key.

from pyspoti.core import SpotifyClient, ArtistAPI, AlbumAPI, TrackAPI, SearchAPI

with SpotifyClient(client_id, client_secret) as client:
    # search
    artists = ArtistAPI(client).search("Summoning")
    albums = AlbumAPI(client).search("Minas Morgul")
    tracks = TrackAPI(client).search("Long Lost to Where")

    # cross-type search
    results = SearchAPI(client).search("Summoning")
    # → {"artists": [...], "albums": [...], "tracks": [...]}

    # fetch full details
    artist = ArtistAPI(client).get(artists[0]["id"])
    top_tracks = ArtistAPI(client).get_top_tracks(artist["id"])
    discography = ArtistAPI(client).get_albums(artist["id"])

    album = AlbumAPI(client).get(discography[0]["id"])
    track = TrackAPI(client).get(top_tracks[0]["id"])

    # download images
    client.download_image(artist["image_url"], output_dir="./images/")

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyspoti-0.3.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyspoti-0.3.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file pyspoti-0.3.0.tar.gz.

File metadata

  • Download URL: pyspoti-0.3.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyspoti-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9d3122e54df72eaa4d9c589e8320b8a54bd3d1a418f4d5d78c1983ab662008e6
MD5 f9ea245bdfe929b3615ec38afdcaf96b
BLAKE2b-256 ef719c2c56ef93c673014a703937d93ffb6bbc9e360b16ac53f5f0d1b411cab8

See more details on using hashes here.

File details

Details for the file pyspoti-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyspoti-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pyspoti-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2352691932087699486d92970737a043e3114e4381ab1b00b9a539bbd27985e
MD5 b4bb7fd6f9692eb8098a3cbceed781a8
BLAKE2b-256 9ad3f3bf94f48fac6a712fa75149a471ac5f6ef5de6631830e50294474d91e11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page