The spotifyremoji
package is a wrapper package for the Spotify API.
This is an R wrapper for the Spotify API.
Three main functions in spotifyremoji
:
compare_artists(user_auth_token, artist1, artist2, artist3)
:
user_auth_token
: A string of a unique authentication token, which can be acquired using the steps listed below under Authentication.artist1
,artist2
,artist3
: Three strings of the names of artists the user wishes to compare.ggplot
output graph.compare_artists(my_token, 'vybz kartel’, 'candlemass', 'brockhampton')
related_artists(user_auth_token, artistName)
:
user_auth_token
: A string of a unique authentication token, which can be acquired using the steps listed below under Authentication.artistName
: A string identifying an artist of which the user wishes to find similar artistsExample of use:
related_artists(my_token, 'Haftbefel')
get_top_artists_for_user(user_auth_token, limit_num, time_range_opt)
:
user_auth_token
: A string of a unique authentication token, which can be acquired using the steps listed below under Authentication.limit_num
: An integer between 1 and 50 (inclusive), specifying the number of 'top artists' to return. time_range_opt
: an integer, either 1,2 or 3long_term
is last several years of datamedium_term
is last 6 monthsshort_term
last 4 weeksExample of use:
get_top_artists_for_user(my_token, 50, 2)
All of our functions require an authentication token. For more information on how to set up an authentication token please see Spotify Docs.
We have two easier options for users of this package to be able to provide the authentication tokens (the harder option is to read the authorization guide and set it up).
Option 1:
- Login to Spotify for Developers and Create an Client ID.
- Click on
Web Console
, then pick an API call to explore. For instance clickPersonalization
and then click on theGet User's Top Artists and Tracks
end-point. Or can just click: https://beta.developer.spotify.com/console/get-current-user-top-artists-and-tracks/.- Scroll down and click
GET TOKEN
under the OAuth Token Heading. Copy this string to your clipboard and use it with the above functions.
Option 2:
- Login to Spotify for Developers and Create an Client ID.
- Link to Jordan Roth's Repo:
- Instructions for how to generate a local app.
Option 3:
Develop your own Web App for Authorization following the Spotify Guides linked above.
To install the package:
devtools::install_github("akleefel/spotifyremoji")
EXPLANATION
library(spotifyremoji)
Important: In order for the tests to run successfully, one must open .Renviron
and update the SPOTIFY_TOKEN
to an active working token. This can be referenced with the command Sys.getenv("SPOTIFY_TOKEN")
. Once the .Renviron
file has been updated a new Rstudio session must be started for it to update appropriately.
This is an open source project. Therefore, feedback, suggestions, and contributions are very welcome. For feedback and suggestions, please open an issue in this repo. If you are willing to contribute this package, please refer to Contributing guidelines for details.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.