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.2.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.2.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyspoti-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d53c33fcd7d4ab70837981bc7d32b4c6961ae07291244f1dc76629e99972e09a
MD5 371749298c2894d718f6d3d1a87a214a
BLAKE2b-256 c16418ce525d1d2e8586d325ec387dd2f11386b9e5e7884e47556e652081bafa

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pyspoti-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9e906478b609bc1f4ca31e5305d11b9b64913d2132990717224a14f75c6c9ed
MD5 af8f16bfb322c0f69ea1178015098239
BLAKE2b-256 73b32b6990da918570a732ca74078218f216cc4ee19e98baad22e8f3e279708c

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