spotifyr is an R wrapper for pulling track audio features and other information from Spotify’s Web API in bulk. By automatically batching API requests, it allows you to enter an artist’s name and retrieve their entire discography in seconds, along with Spotify’s audio features and track/album popularity metrics. You can also pull song and playlist information for a given Spotify User (including yourself!).
Overview
Spotipy's full documentation is online at Spotipy Documentation. You can ask questions about Spotipy on Stack Overflow. Don’t forget to add the Spotipy tag, and any other relevant tags as well, before posting. If you have suggestions, bugs or other issues specific to this library, file them here. Spotifyr is an R wrapper for pulling track audio features and other information from Spotify’s Web API in bulk. By automatically batching API requests, it allows you to enter an artist’s name and retrieve their entire discography in seconds, along with Spotify’s audio features and track/album popularity metrics. Here we link to some simple examples that demonstrate the capabilities of the Spotify Web API and to wrapper libraries for various languages. Web API Tutorial; Basic snippets; Example apps; Libraries; Web API Tutorial Example App Code. This is the application code that goes with our Web API Tutorial.
Installation
CRAN version 2.1.0 (recommended)
Development version
Authentication
First, set up a Dev account with Spotify to access their Web API here. This will give you your
Client ID and Client Secret . Once you have those, you can pull your access token into R with get_spotify_access_token() .
The easiest way to authenticate is to set your credentials to the System Environment variables
SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET . The default arguments to get_spotify_access_token() (and all other functions in this package) will refer to those. Alternatively, you can set them manually and make sure to explicitly refer to your access token in each subsequent function call.
Authorization code flow
For certain functions and applications, you’ll need to log in as a Spotify user. To do this, your Spotify Developer application needs to have a callback url. You can set this to whatever you want that will work with your application, but a good default option is
http://localhost:1410/ (see image below). For more information on authorization, visit the offical Spotify Developer Guide.
UsageWhat was The Beatles’ favorite key?
Get your most recently played tracks
Find your all time favorite artists
Find your favorite tracks at the moment
What’s the most joyful Joy Division song?
My favorite audio feature has to be “valence,” a measure of musical positivity.
Now if only there was some way to plot joy…
Joyplot of the emotional rollercoasters that are Joy Division’s albumsSentify: A Shiny app
This app, powered by spotifyr, allows you to visualize the energy and valence (musical positivity) of all of Spotify’s artists and playlists.
Dope stuff other people have done with spotifyr
The coolest thing about making this package has definitely been seeing all the awesome stuff other people have done with it. Here are a few examples:
Exploring the Spotify API with R: A tutorial for beginners, by a beginner, Mia Smith
Sentiment analysis of musical taste: a cross-European comparison, Paul Elvers
Blue Christmas: A data-driven search for the most depressing Christmas song, Caitlin Hudon
KendRick LamaR, David K. Laing
Vilken är Kents mest deprimerande låt? (What is Kent’s most depressing song?), Filip Wästberg
Чёрное зеркало Arcade Fire (Black Mirror Arcade Fire), TheSociety
Sente-se triste quando ouve “Amar pelos dois”? Não é o único (Do you feel sad when you hear “Love for both?” You’re not alone), Rui Barros, Rádio Renascença
https://coursesbrown909.weebly.com/spotify-app-create-playlist.html. Using Data to Find the Angriest Death Grips Song, Evan Oppenheimer
Hierarchical clustering of David Bowie records, Alyssa Goldberg
tayloR, Simran Vatsa
Long Distance Calling: Data Science meets Post-Rock…, Sebastian Kuhn
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |