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", "show", "episode"),
market = NULL,
limit = 20,
offset = 0,
include_external = NULL,
authorization = get_spotify_access_token(),
include_meta_info = FALSE
)
A tibble with detailed information about the searched album, artist, playlist, track or their combination.
Required.
Search query keywords and optional field filters and operators.
A character vector of item types to search across.
Valid types are album
, artist
, playlist
, track
, show
and episode
.
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 (except for shows and episodes).
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 Web API authorization guide for more details. Defaults to spotifyr::get_spotify_access_token()
Optional. Boolean indicating whether to include full result, with meta information such as "total"
, and "limit"
. Defaults to FALSE
.
if (FALSE) {
search_spotify('radiohead', 'artist')
}
Run the code above in your browser using DataLab