An open API service indexing awesome lists of open source software.

https://github.com/ewenme/geniusr

work with data & lyrics from Genius
https://github.com/ewenme/geniusr

genius genius-api lyrics r rstats

Last synced: 8 months ago
JSON representation

work with data & lyrics from Genius

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(
echo = TRUE, warning = FALSE, message = FALSE, collapse = TRUE,
comment = "#>", fig.path = "man/figures/README-"
)
```

# geniusr

[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![CRAN status](https://www.r-pkg.org/badges/version/geniusr)](https://cran.r-project.org/package=geniusr)
[![DLs](http://cranlogs.r-pkg.org/badges/geniusr)](http://cran.rstudio.com/web/packages/geniusr/index.html)
[![Travis build Status](https://travis-ci.org/ewenme/geniusr.png)](https://travis-ci.org/ewenme/geniusr)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/ewenme/geniusr?branch=master&svg=true)](https://ci.appveyor.com/project/ewenme/geniusr)
[![Codecov test coverage](https://codecov.io/gh/ewenme/geniusr/branch/master/graph/badge.svg)](https://codecov.io/gh/ewenme/geniusr?branch=master)

## Overview

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

- Genius Developers Site: [https://genius.com/developers](https://genius.com/developers)
- Genius API Docs: [https://docs.genius.com/](https://docs.genius.com/)

## Install

Get the latest stable version from CRAN...

```{r, eval = FALSE}
install.packages("geniusr")
```

...or install the development version from Github (recommended).

```{r install_dev, eval=FALSE}
remotes::install_github("ewenme/geniusr")
```

## Authenticate

1. [Create a Genius API client](https://genius.com/api-clients/new)
2. Generate a client access token from your [API Clients page](https://genius.com/api-clients)
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!](https://ewenme.github.io/geniusr/articles/geniusr.html)

### How many times did 'Ye say "good morning", on the track "Good Morning"?

```{r good_morning_count}

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()
```

## 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](https://ewenme.github.io/geniusr//CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.

## Related work

- the [genius](https://github.com/JosiahParry/genius) package specialises in lyrics retrieval from Genius.