#' getLyrics
#'
#' This function gets the lyrics of a track.
#'
#' @param idtrack Track's ID
#' @param apikey Your API Key provided by MusixMatch
#' @export
#' @examples
#' apikey="YOUR_API_KEY")
#' getlyrics(15953433,apikey)
getLyrics<-function(id_track,apikey){
require(jsonlite)
metadata<-jsonlite::fromJSON(paste0(
"http://api.musixmatch.com/ws/1.1/track.lyrics.get?track_id=",id_track,"&apikey=",apikey))
tracks<-data.frame(track_id=id_track,
lyrics_id=metadata$message$body$lyrics$lyrics_id,
explicit=metadata$message$body$lyrics$explicit,
lyrics_body=gsub("[\r\n]", " ", metadata$message$body$lyrics$lyrics_body))
return(tracks)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.