4 releases (breaking)
0.5.0 | May 28, 2022 |
---|---|
0.4.0 | Sep 19, 2021 |
0.3.0 | Aug 6, 2021 |
0.2.1 | Aug 1, 2021 |
#9 in #genius
27 downloads per month
36KB
588 lines
genius_rs
Rust library that allows interact with Genius API.
Searching for a song
use genius_rs::Genius;
#[tokio::main]
async fn main() {
let genius = Genius::new(dotenv::var("TOKEN").unwrap());
let response = genius.search("Ariana Grande").await.unwrap();
println!("{}", response[0].result.full_title);
}
Getting lyrics
use genius_rs::Genius;
#[tokio::main]
async fn main() {
let genius = Genius::new(dotenv::var("TOKEN").unwrap());
let response = genius.search("Sia").await.unwrap();
let lyrics = genius.get_lyrics(&response[0].result.id).await.unwrap();
for verse in lyrics {
println!("{}", verse);
}
}
Getting deeper information for a song by id
use genius_rs::Genius;
#[tokio::main]
async fn main() {
let genius = Genius::new(dotenv::var("TOKEN").unwrap());
let response = genius.search("Weeknd").await.unwrap();
let song = genius.get_song(response[0].result.id, "plain").await.unwrap();
println!("{}", song.media.unwrap()[0].url)
}
Dependencies
~5–17MB
~249K SLoC