spotapi

Crates.iospotapi
lib.rsspotapi
version0.1.0
created_at2026-01-09 14:49:23.857998+00
updated_at2026-01-09 14:49:23.857998+00
descriptionA professional Rust crate for fetching Spotify playlist metadata and tracks without authentication handling.
homepage
repositoryhttps://github.com/spotapi/spotapi-rs
max_upload_size
id2032207
size70,039
RayZ3R0 (RayZ3R0)

documentation

README

SpotAPI - Rust

A professional Rust crate that mimics the functionality of the Python SpotAPI package, specifically focused on fetching Spotify playlist metadata and tracks seamlessly handled via guest authentication.

Features

  • Guest Authentication: Automatically handles guest token generation and session management.
  • Playlist Fetching: Retrieval of detailed playlist metadata.
  • Pagination Support: Automatically handles pagination to fetch all tracks in a playlist, regardless of size.
  • Dynamic Analysis: robustly analyzes Spotify's web player to ensure compatibility with API changes.

Installation

Add this to your Cargo.toml:

[dependencies]
spotapi = "0.1.0"

Usage

Here is a simple example of how to fetch all tracks from a playlist:

use spotapi::PublicPlaylist;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let playlist_url = "https://open.spotify.com/playlist/37i9dQZF1DX6ujZpAN0v9r";
    let mut playlist = PublicPlaylist::new(playlist_url);

    // Fetch all tracks (handles pagination automatically)
    let tracks = playlist.get_tracks().await?;

    println!("Fetched {} tracks.", tracks.len());

    if let Some(first) = tracks.first() {
        println!("First track data: {:?}", first);
    }

    Ok(())
}

Disclaimer

This library is intended for educational purposes. It interacts with Spotify's private API. Use responsibly and in accordance with Spotify's terms of service.

Commit count: 0

cargo fmt