Get Spotify Catalog information about artists, albums, tracks or playlists that match a keyword string. For more information see the official documentation.
search_spotify(q, type = c("album", "artist", "playlist", "track"),
market = NULL, limit = 20, offset = 0, include_external = NULL,
authorization = get_spotify_access_token())
Required.
Search query keywords and optional field filters and operators.
For example: q = "roadhouse+blues"
.
A character vector of item types to search across.
Valid types are album
, artist
, playlist
, and track
.
Search results include hits from all the specified item types.
For example: q = "name:abacab"
and type =c("album", "track")
returns both albums and tracks with "abacab"
included in their name.
Optional.
An ISO 3166-1 alpha-2 country code or the string "from_token"
.
If a country code is specified, only artists, albums, and tracks with content that is playable in that market is returned.
Note:
- Playlist results are not affected by the market parameter.
- If market is set to "from_token"
, and a valid access token is specified in the request header, only content playable in the country associated with the user account, is returned.
- Users can view the country that is associated with their account in the account settings. A user must grant access to the user-read-private scope prior to when the access token is issued.
Optional.
Maximum number of results to return.
Default: 20
Minimum: 1
Maximum: 50
Note: The limit is applied within each type, not on the total response.
For example, if the limit value is 3 and the type is c("artist", "album")
, the response contains 3 artists and 3 albums.
Optional. The index of the first result to return. Default: 0 (the first result). Maximum offset (including limit): 10,000. Use with limit to get the next page of search results.
Optional.
Possible values: audio
If include_external = "audio"
is specified the response will include any relevant audio content that is hosted externally.
By default external content is filtered out from responses.
Required. A valid access token from the Spotify Accounts service. See the https://developer.spotify.com/documentation/general/guides/authorization-guide/ for more details. Defaults to spotifyr::get_spotify_access_token()
# NOT RUN {
search_spotify('radiohead', 'artist')
# }
Run the code above in your browser using DataCamp Workspace