Type: | Package |
Title: | Access to Spotify API |
Version: | 0.1.2 |
Author: | Tiago Mendes Dantas |
Maintainer: | Tiago Mendes Dantas <t.mendesdantas@gmail.com> |
Description: | Provides an interface to the Spotify API https://developer.spotify.com/documentation/web-api/. |
License: | GPL-2 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.1.0 |
Imports: | dplyr, plyr, httr, jsonlite, magrittr |
NeedsCompilation: | no |
Packaged: | 2018-08-13 13:16:13 UTC; tiagomendedantas |
Repository: | CRAN |
Date/Publication: | 2018-08-13 14:10:12 UTC |
Get the tracks from an Album
Description
Get Spotify catalog information about an album’s tracks.
Usage
getAlbum(album_id, token)
Arguments
album_id |
The Spotify ID for the album. |
token |
An OAuth token created with |
Value
get Album from an artist using their ID
Get additional album info
Description
function to get additional album info from an artist using the Album ID
Usage
getAlbumInfo(album_id, token)
Arguments
album_id |
The Spotify ID for the album.. |
token |
An OAuth token created with |
Value
'Get an Artist’s Albums
Get albums from an Artist
Description
function to get albums from an artist using their ID
Usage
getAlbums(artist_id, market = "US", token)
Arguments
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 |
Value
'Get Albums from an Artist
Examples
## Not run:
foofighters_albums<-getAlbums("7jy3rLJdDQY21OgRLCZ9sD",market="US",token)
## End(Not run)
Get Spotify catalog information for a single artist
Description
Function to get Spotify catalog information for a single artist identified by their unique Spotify ID.
Usage
getArtist(artist_id, token)
Arguments
artist_id |
The Spotify ID of the artist. |
token |
An OAuth token created with |
Value
Get Spotify catalog information for a single artist identified by its unique Spotify ID.
Examples
## Not run:
foofighters<-getArtist("7jy3rLJdDQY21OgRLCZ9sD",token)
## End(Not run)
Get audio feature information for a single track
Description
function to get audio feature information for a single track identified by its unique Spotify ID.
Usage
getFeatures(track_id, token)
Arguments
track_id |
The Spotify ID for the track. |
token |
An OAuth token created with |
Get the songs of a specific playlist
Description
function to get songs about a specifc playlist
Usage
getPlaylistSongs(user_id, playlist_id, offset = 0, token)
Arguments
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 |
Get the playlists of a specific user
Description
function to get Info about the playlists of a specific user the user_id
Usage
getPlaylists(user_id, offset = 0, token)
Arguments
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 |
Value
get playlist from a specific user using a username
Get Related artists
Description
function to get the related artists of an Artist
Usage
getRelated(artist_name, token)
Arguments
artist_name |
Name of the artist (can use name or Spotify ID of the artist) |
token |
An OAuth token created with |
Get top tracks of an Artist
Description
function to get top tracks of an Artist.
Usage
getTopTracks(artist_id, country, token)
Arguments
artist_id |
Artist ID |
country |
Country of interest |
token |
An OAuth token created with |
Get a Track
Description
Get Spotify catalog information for a single track identified by its unique Spotify ID.
Usage
getTrack(track_id, token)
Arguments
track_id |
The Spotify ID for the track. |
token |
An OAuth token created with |
Get basic information about an User
Description
function to get User's basic information
Usage
getUser(user_id, token)
Arguments
user_id |
user id |
token |
An OAuth token created with |
Examples
## 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)
Search for a specific artist
Description
function to get basic info about a searched artist
Usage
searchArtist(artist_name, token)
Arguments
artist_name |
Name of the artist |
token |
An OAuth token created with |
Examples
## 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)
Search for playlists
Description
function to search for playlists given a name
Usage
searchPlaylist(playlistName, offset = 0, token = token)
Arguments
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
Description
Search for a specific Track
function to get basic info about a searched track
Usage
searchTrack(track, token)
Arguments
track |
Name of the track |
token |
An OAuth token created with |
Examples
## 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)
Create OAuth token to access Spotify web API
Description
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
Usage
spotifyOAuth(app_id, client_id, client_secret)
Arguments
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 |
Examples
## 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)