Title: | Providing Convenience Functions to Connect R with the Spotify API |
---|---|
Description: | Providing convenience functions to connect R with the 'Spotify' application programming interface ('API'). At first it aims to help setting up the OAuth2.0 Authentication flow. The default output of the get_*() functions is tidy, but optionally the functions could return the raw response from the 'API' as well. The search_*() and get_*() functions can be combined. See the vignette for more information and examples and the official Spotify for Developers website <https://developer.spotify.com/documentation/web-api/> for information about the Web 'API'. |
Authors: | Lennard van Wanrooij |
Maintainer: | Lennard van Wanrooij <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-07 06:30:51 UTC |
Source: | CRAN |
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/albums/{id}/
get_album( album_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_album( album_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
album_id |
Required. Get Spotify Catalog information for this album_id. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/albums{id}/tracks/
get_album_tracks( album_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_album_tracks( album_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
album_id |
Required. Get Spotify Catalog information for the tracks of this album_id. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/albums/
get_albums( album_ids, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_albums( album_ids, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
album_ids |
Required. Expects a comma-separated character string of album_ids. Get Spotify Catalog information for these album_ids. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/artists/{id}/
get_artist( artist_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_artist( artist_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
artist_id |
Required. Get Spotify Catalog information for this artist_id. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/artists/{id}/albums/
get_artist_albums( artist_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_artist_albums( artist_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
artist_id |
Required. Get Spotify Catalog information for the albums of this artist_id. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0.. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/artists/{id}/top-tracks/
get_artist_top_tracks( artist_id, country, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_artist_top_tracks( artist_id, country, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
artist_id |
Required. Get Spotify Catalog information for the top tracks of this artist_id in the given country. |
country |
Required. ISO-code of country. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0.20. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/artists/
get_artists( artist_ids, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_artists( artist_ids, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
artist_ids |
Required. Expects a comma-separated character string of artist_ids. Get Spotify Catalog information for these artist_ids. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Gets an OAuth2.0 token to connect with the Spotify API.
get_spotify_api_token(client_id, client_secret)
get_spotify_api_token(client_id, client_secret)
client_id |
Your client id. Required. |
client_secret |
Your client secret. Required. |
In case the request succeeded, a token to connect with the Spotify API. On failure, a message indicating that authentication failed.
The vignette Connecting-with-the-Spotify-API
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/tracks/{id}/
get_track( track_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_track( track_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
track_id |
Required. Get Spotify Catalog information for this track_id. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/audio-features/{id}/
get_track_audio_features( track_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_track_audio_features( track_id, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
track_id |
Required. Expects a single track_id. Get Spotify Catalog information for this track_id. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/tracks/
get_tracks( track_ids, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_tracks( track_ids, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
track_ids |
Required. Get Spotify Catalog information for these track_ids. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/audio-features/
get_tracks_audio_features( track_ids, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
get_tracks_audio_features( track_ids, output = c("tidy", "raw"), limit = 20, offset = 0, token = my_token )
track_ids |
Required. Expects a comma-separated character string of track_ids. Get Spotify Catalog information for these track_ids. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/search/
search_albums( album_name, output = c("tidy", "raw", "id"), limit = 20, offset = 0, token = my_token )
search_albums( album_name, output = c("tidy", "raw", "id"), limit = 20, offset = 0, token = my_token )
album_name |
Required. Get Spotify Catalog information about albums that match this input. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request, or When output is set to id, it returns only the id.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/search/
search_artists( artist_name, output = c("tidy", "raw", "id"), limit = 20, offset = 0, token = my_token )
search_artists( artist_name, output = c("tidy", "raw", "id"), limit = 20, offset = 0, token = my_token )
artist_name |
Required. Get Spotify Catalog information about artists that match this input. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request, or When output is set to id, it returns only the id.
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/search/
search_tracks( track_name, output = c("tidy", "raw", "id"), limit = 20, offset = 0, token = my_token )
search_tracks( track_name, output = c("tidy", "raw", "id"), limit = 20, offset = 0, token = my_token )
track_name |
Required. Get Spotify Catalog information about tracks that match this input. |
output |
Type of output to return from the request. Default: tidy. |
limit |
Maximum number of results to return. Should be between 1 and 50. Default: 20. |
offset |
The index of the first result to return. Default: 0.0. |
token |
A valid access token from the Spotify Accounts service: see https://developer.spotify.com/documentation/general/guides/authorization-guide/ for details. Default: my_token. |
Default: returns a tidy dataframe with a selection of the response. Alternatively, when output is set to raw, it returns the raw output from the request, or When output is set to id, it returns only the id.