Search¶
Warning
The search API was broken at 2016-02-03 by a server-side change made by Spotify. The functionality was never restored.
Please use the Spotify Web API to perform searches.
-
class
spotify.
Search
(session, query='', callback=None, track_offset=0, track_count=20, album_offset=0, album_count=20, artist_offset=0, artist_count=20, playlist_offset=0, playlist_count=20, search_type=None, sp_search=None, add_ref=True)[source]¶ A Spotify search result.
Call the
search()
method on yourSession
instance to do a search and get aSearch
back.-
loaded_event
= None¶ threading.Event
that is set when the search is loaded.
-
property
is_loaded
¶ Whether the search’s data is loaded.
-
property
error
¶ An
ErrorType
associated with the search.Check to see if there was problems loading the search.
-
load
(timeout=None)[source]¶ Block until the search’s data is loaded.
After
timeout
seconds with no resultsTimeout
is raised. Iftimeout
isNone
the default timeout is used.The method returns
self
to allow for chaining of calls.
-
property
query
¶ The search query.
Will always return
None
if the search isn’t loaded.
-
property
did_you_mean
¶ The search’s “did you mean” query or
None
if no such suggestion exists.Will always return
None
if the search isn’t loaded.
-
property
tracks
¶ The tracks matching the search query.
Will always return an empty list if the search isn’t loaded.
-
property
track_total
¶ The total number of tracks matching the search query.
If the number is larger than the interval specified at search object creation, more search results are available. To fetch these, create a new search object with a new interval.
-
property
albums
¶ The albums matching the search query.
Will always return an empty list if the search isn’t loaded.
-
property
album_total
¶ The total number of albums matching the search query.
If the number is larger than the interval specified at search object creation, more search results are available. To fetch these, create a new search object with a new interval.
-
property
artists
¶ The artists matching the search query.
Will always return an empty list if the search isn’t loaded.
-
property
artist_total
¶ The total number of artists matching the search query.
If the number is larger than the interval specified at search object creation, more search results are available. To fetch these, create a new search object with a new interval.
-
property
playlists
¶ The playlists matching the search query as
SearchPlaylist
objects containing the name, URI and image URI for matching playlists.Will always return an empty list if the search isn’t loaded.
-
property
playlist_total
¶ The total number of playlists matching the search query.
If the number is larger than the interval specified at search object creation, more search results are available. To fetch these, create a new search object with a new interval.
-
more
(callback=None, track_count=None, album_count=None, artist_count=None, playlist_count=None)[source]¶ Get the next page of search results for the same query.
If called without arguments, the
callback
and*_count
arguments from the original search is reused. If anything other thanNone
is specified, the value is used instead.
-
-
class
spotify.
SearchPlaylist
(session, name, uri, image_uri)[source]¶ A playlist matching a search query.
-
name
= None¶ The name of the playlist.
-
uri
= None¶ The URI of the playlist.
-
image_uri
= None¶ The URI of the playlist’s image.
-
property
playlist
¶ The
Playlist
object for thisSearchPlaylist
.
-
property
image
¶ The
Image
object for thisSearchPlaylist
.
-