Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Get Basic Track Details From The Spotify API In Rust

rust
//! ```cargo
//! [dependencies]
//! rspotify = { version = "0.12.0", default-features = false, features = ["client-reqwest", "reqwest-native-tls", "env-file"] }
//! tokio = { version = "1.11.0", features = ["rt-multi-thread", "macros"] }
//! ```

use rspotify::{model::TrackId, prelude::*, ClientCredsSpotify, Credentials};

#[tokio::main]
async fn main() {
    let creds = Credentials::from_env().unwrap();
    let spotify = ClientCredsSpotify::new(creds);
    spotify.request_token().await.unwrap();
    let track_id = TrackId::from_uri("spotify:track:4rc6aeLJCWqZ3GBW5rU1P1").unwrap();
    let track = spotify.track(track_id, None).await;
    dbg!(track.ok());
}
results start