Spotify is the main streaming outlet for millions and offers music as well as podcasts. The streaming era has changed the music industry forever. Gone are the days of album sales indicating what artists were really on top.Spotify streaming data can be used to better understand who is at the top of the charts and further understand trends in users listening habits for a better understanding of whats popular and where music as an industry is headed.
I also feel like the streaming era has brought on a lot more one hit wonders and has generally lowered the ability of artists to remain relevant over multiple years. I would eventually like to combine the data from this API with Tik Tok data and explore the phenomenon of ‘Tik Tok songs’
library(spotifyr)
#Starting up# First login to your spotify account on their developer website.
You are then going to want to create an app, this is found in the dashboard. Then go to the settings where you can access your client Id and client secret. You should then open R and download the spotifyr package. This enables you to get your access token after ending the code below.
## [1] "Sys.setenv(SPOTIFY_CLIENT_ID = )"
## [1] "Sys.setenv(SPOTIFY_CLIENT_SECRET = )"
## [1] "access_token <- get_spotify_access_token()"
Now that you have your access token you can begin interacting with the API
recent_songs <- get_my_top_artists_or_tracks(type = 'tracks',
time_range = 'short_term',
limit = 5)
playlists <- get_my_playlists()
These calls give information on the most listened to songs on your account as well as an overview of your playlists