# library(spotifyr)
# library(tidyverse)
# library(httpuv)
# library(knitr)
# library(lubridate)Assignment 5
Introduction
The service I intend to demonstrate is my Spotify data such as who my top artists are, what songs I listen to, or learn various information about some of the artist’s songs I listen to. In a company this could be used for creating customizable playlists for targeting a group of people or featuring popular artist as sponsors for your product based on your target groups playlists. I chose this because Spotify is my preferred application to listen to music on.
R
Below are some libraries that must be loaded into your script for the Spotify API to function properly
Setting up Spotify API
- Log in to Spotify API dashboard using your Spotify account at https://developer.spotify.com/documentation/web-api
- In top right corner select dashboard from the click-down arrow
- Click create app:
- Enter the name of your app (ex: “Spotify_462”)
- Enter an app description to explain what you are using the app for (ex: “School”)
- Enter the website of your company (ex: https://www.xavier.edu/)
- Enter a redirect URI which is the location where the authorization server sends the user after the app is authorized
- Do not check anything in the box that asks you select web api or sdk
- Next you must agree to the terms and services of Spotify’s “Developer” by checking the box
- Click save
R, API Features:
In this code I first demonstrate how to create a vector for Selena Gomez songs by calling the API for any songs she is in. Next I create a csv file of her songs and the information of her songs that Spotify has. After that I decided to call the API to retrieve information of the top five keys that are used in her songs.
# Call to action for Selena Gomez's audio features
#Selena <-
#get_artist_audio_features('Selena Gomez')
# reading the csv
#Selena_Gomez <- read_csv("Selena.csv")
# Selena Gomez's top five keys
#Selena_Gomez %>%
#count(key_mode, sort = TRUE) %>%
#head(5) %>%
#kable()