Overview

Tools for working with the Genius (FKA Rap Genius) API.

Install

Get the latest stable version from CRAN…

install.packages("geniusr")

…or install the development version from Github.

remotes::install_github("ewenme/geniusr")

Authenticate

  1. Create a Genius API client
  2. Generate a client access token from your API Clients page
  3. Set your credentials in the System Environment variable GENIUS_API_TOKEN by calling the genius_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