knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The goal of musicbrainz is to make it easy to call the MusicBrainz Database API from R. Currently API does NOT require authentication for reading the data, however, requests to the database are subject to a rate limit of 1 request/sec. The package utilizes ratelimitr
to make sure you don't need to worry about exceeding that limit.
You can install musicbrainz from github with:
# install.packages("devtools") devtools::install_github("dmi3kno/musicbrainz")
There are three families of functions in musicbrainz
package: search, lookup and browse.
Lets search information about Miles Davis
library(musicbrainz) library(dplyr) miles_df <- search_artists("Miles Davis") miles_df
It looks like the first hit is what we need. We can use dplyr
to extract the information of interest
miles_id <- miles_df %>% select(mbid) %>% slice(1) %>% pull()
Now that we have MusicBrainz id ("mbid") we can call the lookup function.
miles_lookup <- lookup_artist_by_id("561d854a-6a28-4aa7-8c99-323e6ce46c2a") miles_lookup
We can also browse linked records (such as all releases by Miles Davis).
miles_releases <- browse_releases_by("artist", "561d854a-6a28-4aa7-8c99-323e6ce46c2a") miles_releases
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.