tsirysndr / lastfm-rs

Rust client library for accessing the Last.fm API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lastfm-rs

License: BSD Twitter: tsiry_sndr

lastfm-rs is a Rust client library for accessing the Last.fm API

Install

[dependencies]
lastfm-rs = { git = "https://github.com/tsirysndr/lastfm-rs" }

Usage

Construct a new Lastfm client, then use the various services on the client to access different parts of the Last.fm API. For example:

use lastfm_rs::Lastfm;

#[tokio::main]
async fn main() {
  let client = Lastfm::new("3721a0792cecc9d0981a1a08a2ed15d1");
  let album = client.album.get_info("Linkin Park", "Meteora").await;
  let album_results = client.album.search("Meteora").await;
  let artist = client.artist.get_info("Linkin Park").await;
  let artist_results = client.artist.search("Linkin Park").await;
  let track = client.track.get_info("Linkin Park", "papercut").await;
  let similar_artists = client.artist.get_similar("Linkin Park").await;
  let top_albums = client.artist.get_top_albums("Linkin Park").await;

  println!("{:#?}", album.unwrap());
  println!("{:#?}", album_results.unwrap());
  println!("{:#?}", artist.unwrap());
  println!("{:#?}", artist_results.unwrap());
  println!("{:#?}", track.unwrap());
  println!("{:#?}", similar_artists.unwrap());
  println!("{:#?}", top_albums.unwrap());
}

Author

👤 Tsiry sandratraina

Show your support

Give a ⭐️ if this project helped you!

About

Rust client library for accessing the Last.fm API

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Rust 100.0%