Title: | Access to Spotify API |
---|---|
Description: | Provides an interface to the Spotify API <https://developer.spotify.com/documentation/web-api/>. |
Authors: | Tiago Mendes Dantas |
Maintainer: | Tiago Mendes Dantas <[email protected]> |
License: | GPL-2 |
Version: | 0.1.2 |
Built: | 2025-02-13 04:42:37 UTC |
Source: | https://github.com/cran/Rspotify |
Get Spotify catalog information about an album’s tracks.
getAlbum(album_id, token)
getAlbum(album_id, token)
album_id |
The Spotify ID for the album. |
token |
An OAuth token created with |
get Album from an artist using their ID
function to get additional album info from an artist using the Album ID
getAlbumInfo(album_id, token)
getAlbumInfo(album_id, token)
album_id |
The Spotify ID for the album.. |
token |
An OAuth token created with |
'Get an Artist’s Albums
function to get albums from an artist using their ID
getAlbums(artist_id, market = "US", token)
getAlbums(artist_id, market = "US", token)
artist_id |
The Spotify ID for the artist. |
market |
Optional. An ISO 3166-1 alpha-2 country code. Supply this parameter to limit the response to one particular geographical market. For example, for albums available in Sweden: market=SE. |
token |
An OAuth token created with |
'Get Albums from an Artist
## Not run: foofighters_albums<-getAlbums("7jy3rLJdDQY21OgRLCZ9sD",market="US",token) ## End(Not run)
## Not run: foofighters_albums<-getAlbums("7jy3rLJdDQY21OgRLCZ9sD",market="US",token) ## End(Not run)
Function to get Spotify catalog information for a single artist identified by their unique Spotify ID.
getArtist(artist_id, token)
getArtist(artist_id, token)
artist_id |
The Spotify ID of the artist. |
token |
An OAuth token created with |
Get Spotify catalog information for a single artist identified by its unique Spotify ID.
## Not run: foofighters<-getArtist("7jy3rLJdDQY21OgRLCZ9sD",token) ## End(Not run)
## Not run: foofighters<-getArtist("7jy3rLJdDQY21OgRLCZ9sD",token) ## End(Not run)
function to get audio feature information for a single track identified by its unique Spotify ID.
getFeatures(track_id, token)
getFeatures(track_id, token)
track_id |
The Spotify ID for the track. |
token |
An OAuth token created with |
function to get Info about the playlists of a specific user the user_id
getPlaylists(user_id, offset = 0, token)
getPlaylists(user_id, offset = 0, token)
user_id |
user id |
offset |
The index of the first playlist to return. Default: 0 (the first object). Maximum offset: 100.000. |
token |
An OAuth token created with |
get playlist from a specific user using a username
function to get songs about a specifc playlist
getPlaylistSongs(user_id, playlist_id, offset = 0, token)
getPlaylistSongs(user_id, playlist_id, offset = 0, token)
user_id |
User id |
playlist_id |
Playlist id |
offset |
The index of the first songs to return. Default: 0 (the first object). Maximum offset: 100.000. |
token |
An OAuth token created with |
function to get the related artists of an Artist
getRelated(artist_name, token)
getRelated(artist_name, token)
artist_name |
Name of the artist (can use name or Spotify ID of the artist) |
token |
An OAuth token created with |
function to get top tracks of an Artist.
getTopTracks(artist_id, country, token)
getTopTracks(artist_id, country, token)
artist_id |
Artist ID |
country |
Country of interest |
token |
An OAuth token created with |
Get Spotify catalog information for a single track identified by its unique Spotify ID.
getTrack(track_id, token)
getTrack(track_id, token)
track_id |
The Spotify ID for the track. |
token |
An OAuth token created with |
function to get User's basic information
getUser(user_id, token)
getUser(user_id, token)
user_id |
user id |
token |
An OAuth token created with |
## Not run: my_oauth <- spotifyOAuth(app_id="xxxx",client_id="yyyy",client_secret="zzzz") save(my_oauth, file="my_oauth") load("my_oauth") tiago <- getUser(user_id="t.mendesdantas",token=my_oauth) ## End(Not run)
## Not run: my_oauth <- spotifyOAuth(app_id="xxxx",client_id="yyyy",client_secret="zzzz") save(my_oauth, file="my_oauth") load("my_oauth") tiago <- getUser(user_id="t.mendesdantas",token=my_oauth) ## End(Not run)
function to get basic info about a searched artist
searchArtist(artist_name, token)
searchArtist(artist_name, token)
artist_name |
Name of the artist |
token |
An OAuth token created with |
## Not run: my_oauth <- spotifyOAuth(app_id="xxxx",client_id="yyyy",client_secret="zzzz") save(my_oauth, file="my_oauth") load("my_oauth") foofighters <- searchArtist("Foo+fighters",token=my_oauth) ## End(Not run)
## Not run: my_oauth <- spotifyOAuth(app_id="xxxx",client_id="yyyy",client_secret="zzzz") save(my_oauth, file="my_oauth") load("my_oauth") foofighters <- searchArtist("Foo+fighters",token=my_oauth) ## End(Not run)
function to search for playlists given a name
searchPlaylist(playlistName, offset = 0, token = token)
searchPlaylist(playlistName, offset = 0, token = token)
playlistName |
Name of the playlist being searched for |
offset |
The index of the first Playlist to return. Default: 0 (the first object). Maximum offset: 100.000. |
token |
An OAuth token created with |
Search for a specific Track
function to get basic info about a searched track
searchTrack(track, token)
searchTrack(track, token)
track |
Name of the track |
token |
An OAuth token created with |
## Not run: my_oauth <- spotifyOAuth(app_id="xxxx",client_id="yyyy",client_secret="zzzz") save(my_oauth, file="my_oauth") load("my_oauth") track <- searchTrack("generator",token=my_oauth) ## End(Not run)
## Not run: my_oauth <- spotifyOAuth(app_id="xxxx",client_id="yyyy",client_secret="zzzz") save(my_oauth, file="my_oauth") load("my_oauth") track <- searchTrack("generator",token=my_oauth) ## End(Not run)
spotifyOAuth
creates a long-lived OAuth access token that enables R to make
authenticated calls to the Spotify API. The token can be saved as a
file in disk to be re-used in future sessions. This function relies on the
httr
package to create the OAuth token
spotifyOAuth(app_id, client_id, client_secret)
spotifyOAuth(app_id, client_id, client_secret)
app_id |
App ID (this is an internal identification for token if you wish to save authorization) |
client_id |
Client ID |
client_secret |
Client Secret |
## Not run: my_oauth <- spotifyOAuth(app_id="xxxx",client_id="yyyy",client_secret="zzzz") save(my_oauth, file="my_oauth") load("my_oauth") tiago <- getUser(user_id="t.mendesdantas",token=my_oauth) ## End(Not run)
## Not run: my_oauth <- spotifyOAuth(app_id="xxxx",client_id="yyyy",client_secret="zzzz") save(my_oauth, file="my_oauth") load("my_oauth") tiago <- getUser(user_id="t.mendesdantas",token=my_oauth) ## End(Not run)