Title: | Providing Convenience Functions to Connect R with the Spotify API |
Version: | 0.1.0 |
Author: | Lennard van Wanrooij |
Maintainer: | Lennard van Wanrooij <lennardvanwanrooij@gmail.com> |
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'. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.1 |
Imports: | magrittr, dplyr, purrr, httr |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2021-03-14 09:21:15 UTC; Lennard |
Repository: | CRAN |
Date/Publication: | 2021-03-16 15:30:02 UTC |
Gets an album
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/albums/{id}/
Usage
get_album(
album_id,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 tracks from an album
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/albums{id}/tracks/
Usage
get_album_tracks(
album_id,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 multiple albums
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/albums/
Usage
get_albums(
album_ids,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 artist
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/artists/{id}/
Usage
get_artist(
artist_id,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 albums from an artist
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/artists/{id}/albums/
Usage
get_artist_albums(
artist_id,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 related artists from an artist
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/artists/{id}/related-artists/
Usage
get_artist_related_artists(
artist_id,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
artist_id |
Required. Get Spotify Catalog information for the related artists 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. |
Value
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 top tracks from an artist
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/artists/{id}/top-tracks/
Usage
get_artist_top_tracks(
artist_id,
country,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 multiple artists
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/artists/
Usage
get_artists(
artist_ids,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 a Spotify API token
Description
Gets an OAuth2.0 token to connect with the Spotify API.
Usage
get_spotify_api_token(client_id, client_secret)
Arguments
client_id |
Your client id. Required. |
client_secret |
Your client secret. Required. |
Value
In case the request succeeded, a token to connect with the Spotify API. On failure, a message indicating that authentication failed.
See Also
The vignette Connecting-with-the-Spotify-API
Gets a track
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/tracks/{id}/
Usage
get_track(
track_id,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 audio features of a single track
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/audio-features/{id}/
Usage
get_track_audio_features(
track_id,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 multiple tracks
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/tracks/
Usage
get_tracks(
track_ids,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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 audio features of multiple tracks
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/audio-features/
Usage
get_tracks_audio_features(
track_ids,
output = c("tidy", "raw"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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.
Search albums based on given input
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/search/
Usage
search_albums(
album_name,
output = c("tidy", "raw", "id"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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.
Search artists based on given input
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/search/
Usage
search_artists(
artist_name,
output = c("tidy", "raw", "id"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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.
Search tracks based on given input
Description
Connects with the Spotify API and returns output from the href https://api.spotify.com/v1/search/
Usage
search_tracks(
track_name,
output = c("tidy", "raw", "id"),
limit = 20,
offset = 0,
token = my_token
)
Arguments
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. |
Value
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.