home ~ projects ~ socials

Get Spotiry Track Analysis From The API In Rust

//! ```cargo
//! [dependencies]
//! rspotify = { version = "0.12.0", default-features = false, features = ["client-ureq", "ureq-rustls-tls", "env-file"] }
//! ```

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

fn main() {
    let creds = Credentials::from_env().unwrap();
    let spotify = ClientCredsSpotify::new(creds);
    spotify.request_token().unwrap();
    let track_id = TrackId::from_uri("spotify:track:4rc6aeLJCWqZ3GBW5rU1P1").unwrap();
    let track = spotify.track_analysis(track_id);
    dbg!(track.ok());
}
Output:
NOTE: The results are very long
-- end of line --