Endpoints
Get the lyrics of a song
async fn advanced_lyrics(&self, query: impl ToString, text_only: bool,
limit: u32) -> HttpResult<Lyrics, MusicError>
async fn lyrics(&self, query: impl ToString) -> HttpResult<Lyrics, MusicError>
//lyrics() is a shortcut for advanced_lyrics() using default parameters(false, 10)
if let Ok(res) = client.music.lyrics("despacito").await {
match res {
Ok(lyrics) => {
//do something with lyrics
},
Err(why) => {
//do something with the <MusicError> struct
}
}
}
Get song recommendations based on a given query
You need to have a premium plan to use this endpoint
async fn advanced_recommendations(&self, tracks: ProviderType,
youtube_token: Option<String>,
limit: Option<u32>,
recommend_type: Option<String>)
-> HttpResult<MusicRecommendationsResponse, MusicError>
async fn recommendations(&self, tracks: ProviderType) -> HttpResult<MusicRecommendationsResponse, MusicError>
//recommendations() is an advanced_recommendations() shortcut using default parameters(None, None, None)
if let Ok(res) = client.music.recommendations(
ProviderType::YoutubeTitles(vec![String::from("despacito")])).await {
match res {
Ok(recommendations) => {
//do something with recommendations
},
Err(why) => {
//do something with the <MusicError> struct
}
}
}
Last updated