search_spotify: Search for an item

View source: R/search.R

search_spotifyR Documentation

Search for an item

Description

Get Spotify Catalog information about artists, albums, tracks or playlists that match a keyword string. For more information see the official documentation.

Usage

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
)

Arguments

q

Required.
Search query keywords and optional field filters and operators.

type

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.

market

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.

limit

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.

offset

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.

include_external

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.

authorization

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()

include_meta_info

Optional. Boolean indicating whether to include full result, with meta information such as "total", and "limit". Defaults to FALSE.

Value

A tibble with detailed information about the searched album, artist, playlist, track or their combination.

Examples

## Not run: 
search_spotify('radiohead', 'artist')

## End(Not run)

spotifyr documentation built on Oct. 30, 2024, 9:13 a.m.