Learn R Programming

spotifyr (version 2.2.4)

get_recommendations: Create a playlist-style listening experience based on seed artists, tracks and genres.

Description

All parameters are optional, but at least one of seed_artists, seed_tracks and seed_genres must be given.

Usage

get_recommendations(
  limit = 20,
  market = NULL,
  seed_artists = NULL,
  seed_genres = NULL,
  seed_tracks = NULL,
  max_acousticness = NULL,
  max_danceability = NULL,
  max_duration_ms = NULL,
  max_energy = NULL,
  max_instrumentalness = NULL,
  max_key = NULL,
  max_liveness = NULL,
  max_loudness = NULL,
  max_mode = NULL,
  max_popularity = NULL,
  max_speechiness = NULL,
  max_tempo = NULL,
  max_time_signature = NULL,
  max_valence = NULL,
  min_acousticness = NULL,
  min_danceability = NULL,
  min_duration_ms = NULL,
  min_energy = NULL,
  min_instrumentalness = NULL,
  min_key = NULL,
  min_liveness = NULL,
  min_loudness = NULL,
  min_mode = NULL,
  min_popularity = NULL,
  min_speechiness = NULL,
  min_tempo = NULL,
  min_time_signature = NULL,
  min_valence = NULL,
  target_acousticness = NULL,
  target_danceability = NULL,
  target_duration_ms = NULL,
  target_energy = NULL,
  target_instrumentalness = NULL,
  target_key = NULL,
  target_liveness = NULL,
  target_loudness = NULL,
  target_mode = NULL,
  target_popularity = NULL,
  target_speechiness = NULL,
  target_tempo = NULL,
  target_time_signature = NULL,
  target_valence = NULL,
  authorization = get_spotify_access_token(),
  include_seeds_in_response = FALSE
)

Value

Returns a data frame of results recommendations. See the official Spotify Web API documentation for more information.

Arguments

limit

Optional. The target size of the list of recommended tracks. For seeds with unusually small pools or when highly restrictive filtering is applied, it may be impossible to generate the requested number of recommended tracks. Debugging information for such cases is available in the response. Default: 20. Minimum: 1. Maximum: 100.

market

Optional. An ISO 3166-1 alpha-2 country code or the string from_token. Provide this parameter if you want to apply Track Relinking. Because min_*, max_* and target_* are applied to pools before relinking, the generated results may not precisely match the filters applied. Original, non-relinked tracks are available via the linked_from attribute of the relinked track response.

seed_artists

A character vector of Spotify IDs for seed artists. Up to 5 seed values may be provided in any combination of seed_artists, seed_tracks and seed_genres.

seed_genres

A character vector of any genres in the set of available genre seeds. Up to 5 seed values may be provided in any combination of seed_artists, seed_tracks and seed_genres.

seed_tracks

A character vector of Spotify IDs for a seed track. Up to 5 seed values may be provided in any combination of seed_artists, seed_tracks and seed_genres.

max_acousticness

Optional. Numeric value between 0 and 1 indicating a hard ceiling on recommended tracks' acousticness.

max_danceability

Optional. Numeric value between 0 and 1 indicating a hard ceiling on recommended tracks' danceability.

max_duration_ms

Optional. Integer indicating a hard ceiling on recommended tracks' duration in milliseconds.

max_energy

Optional. Numeric value between 0 and 1 indicating a hard ceiling on recommended tracks' energy.

max_instrumentalness

Optional. Numeric value between 0 and 1 indicating a hard ceiling on recommended tracks' instrumentalness.

max_key

Optional. Integer ranging from 1 to 12 indicating a hard ceiling on recommended tracks' key.

max_liveness

Optional. Numeric value between 0 and 1 indicating a hard ceiling on recommended tracks' liveness.

max_loudness

Optional. Numeric value between 0 and 1 indicating a hard ceiling on recommended tracks' loudness.

max_mode

Optional. Integer ranging from 0 to 1 indicating a hard ceiling on recommended tracks' mode.

max_popularity

Optional. Integer ranging between 0 and 100 indicating a hard ceiling on recommended tracks' popularity.

max_speechiness

Optional. Numeric value between 0 and 1 indicating a hard ceiling on recommended tracks' speechiness.

max_tempo

Optional. Numeric value indicating a hard ceiling on recommended tracks' tempo.

max_time_signature

Optional. Integer indicating a hard ceiling on recommended tracks' time signature.

max_valence

Optional. Numeric value between 0 and 1 indicating a hard ceiling on recommended tracks' valence.

min_acousticness

Optional. Numeric value between 0 and 1 indicating a hard floor on recommended tracks' acousticness.

min_danceability

Optional. Numeric value between 0 and 1 indicating a hard floor on recommended tracks' danceability.

min_duration_ms

Optional. Integer indicating a hard floor on recommended tracks' duration in milliseconds.

min_energy

Optional. Numeric value between 0 and 1 indicating a hard floor on recommended tracks' energy.

min_instrumentalness

Optional. Numeric value between 0 and 1 indicating a hard floor on recommended tracks' instrumentalness.

min_key

Optional. Integer ranging from 1 to 12 indicating a hard floor on recommended tracks' key.

min_liveness

Optional. Numeric value between 0 and 1 indicating a hard floor on recommended tracks' liveness.

min_loudness

Optional. Numeric value between 0 and 1 indicating a hard floor on recommended tracks' loudness.

min_mode

Optional. Integer ranging from 0 to 1 indicating a hard floor on recommended tracks' mode.

min_popularity

Optional. Integer ranging between 0 and 100 indicating a hard floor on recommended tracks' popularity.

min_speechiness

Optional. Numeric value between 0 and 1 indicating a hard floor on recommended tracks' speechiness.

min_tempo

Optional. Numeric value indicating a hard floor on recommended tracks' tempo.

min_time_signature

Optional. Integer indicating a hard floor on recommended tracks' time signature.

min_valence

Optional. Numeric value between 0 and 1 indicating a hard floor on recommended tracks' valence.

target_acousticness

Optional. Numeric value between 0 and 1 indicating a target value for recommended tracks' acousticness. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_danceability

Optional. Numeric value between 0 and 1 indicating a target value for recommended tracks' danceability. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_duration_ms

Optional. Integer indicating a target value for recommended tracks' duration in milliseconds. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_energy

Optional. Numeric value between 0 and 1 indicating a target value for recommended tracks' energy. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_instrumentalness

Optional. Numeric value between 0 and 1 indicating a target value for recommended tracks' instrumentalness. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_key

Optional. Integer ranging from 1 to 12 indicating a target value for recommended tracks' key. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_liveness

Optional. Numeric value between 0 and 1 indicating a target value for recommended tracks' liveness. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_loudness

Optional. Numeric value between 0 and 1 indicating a target value for recommended tracks' loudness. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_mode

Optional. Integer ranging from 0 to 1 indicating a target value for recommended tracks' mode. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_popularity

Optional. Integer ranging between 0 and 100 indicating a target value for recommended tracks' popularity. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_speechiness

Optional. Numeric value between 0 and 1 indicating a target value for recommended tracks' speechiness. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_tempo

Optional. Numeric value indicating a target value for recommended tracks' tempo. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_time_signature

Optional. Integer indicating a target value for recommended tracks' time signature. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

target_valence

Optional. Numeric value between 0 and 1 indicating a target value for recommended tracks' valence. Tracks with the attribute values nearest to the target values will be preferred. For example, you might request target_energy = 0.6 and target_danceability = 0.8. All target values will be weighed equally in ranking results.

authorization

Required. A valid access token from the Spotify Accounts service. See the Web API authorization guide for more details. Defaults to spotifyr::get_spotify_access_token()

include_seeds_in_response

Optional. Boolean for whether to include seed object in response. Defaults to FALSE.

See Also

Other personalization functions: get_my_top_artists_or_tracks(), get_recommendations_all()

Examples

Run this code
if (FALSE) {
get_recommendations(market = 'SE', seed_genres = 'rock')
}

Run the code above in your browser using DataLab