Skip to contents

Access the Spotify API to get metadata for audio tracks.

Usage

get_spotify_track_info(track_id, api_key = get_spotify_access_token())

Arguments

track_id

The Spotify ID for a track.

api_key

A Spotify access token, from get_spotify_access_token().

Value

A tibble with track metadata, including:

  • album_name: The name of the album the track appears on (if relevant).

  • track_name: The name of the track.

  • artist: The artist of the track.

  • featuring: The artist(s) featured on the track (if relevant).

  • duration_ms: Duration of the track in milliseconds.

  • explicit: Logical. Does the track contain explicit lyrics (TRUE) or not (FALSE).

Examples

# So High School
get_spotify_track_info(track_id = "7Mts0OfPorF4iwOomvfqn1")
#> Request failed [401]. Retrying in 1 seconds...
#> Request failed [401]. Retrying in 3.3 seconds...
#> Error in spotifyr::get_track(track_id, authorization = api_key): Unauthorized (HTTP 401).