Overview
Tools for working with the Genius (FKA Rap Genius) API.
- Genius Developers Site: https://genius.com/developers
- Genius API Docs: https://docs.genius.com/
Install
Get the latest stable version from CRAN…
install.packages("geniusr")
…or install the development version from Github (recommended).
remotes::install_github("ewenme/geniusr")
Authenticate
- Create a Genius API client
- Generate a client access token from your API Clients page
- Set your credentials in the System Environment variable
GENIUS_API_TOKEN
by calling thegenius_token()
function and entering your Genius Client Access Token when prompted.
Use
Start with the basics!
How many times did ’Ye say “good morning”, on the track “Good Morning”?
library(geniusr)
library(dplyr)
library(tidytext)
# get lyrics
get_lyrics_search(artist_name = "Kanye West",
song_title = "Good Morning") %>%
# get lyric bigrams
unnest_tokens(bigram, line, token = "ngrams", n = 2) %>%
# look for good morning
filter(bigram == "good morning") %>%
# count bigram frequency
nrow()
#> [1] 18
Other
- Get citation information for geniusr in R with
citation(package = 'geniusr')
- Please note that the geniusr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Related work
- the genius package specialises in lyrics retrieval from Genius.