spotifywebapipython.models.track

Spotify Web API Track object.

Track(root: dict = None)

Initializes a new instance of the class.

Arguments:
  • root (dict): Spotify Web API JSON response in dictionary format, used to load object attributes; otherwise, None to not load attributes.

The album on which the track appears.

The album object includes a link in href to full information about the album.

Known external ID's for the track.

ImageUrl: str

Gets the first image url in the album Images list, if images are defined; otherwise, null.

Popularity: int

The popularity of the track. The value will be between 0 and 100, with 100 being the most popular.

The popularity of a track is a value between 0 and 100, with 100 being the most popular. The popularity is calculated by algorithm and is based, in the most part, on the total number of plays the track has had and how recent those plays are. Generally speaking, songs that are being played a lot now will have a higher popularity than songs that were played a lot in the past.

Duplicate tracks (e.g. the same track from a single and an album) are rated independently. Artist and album popularity is derived mathematically from track popularity.

Note: the popularity value may lag actual popularity by a few days: the value is not updated in real time.

def ToDictionary(self) -> dict:

Returns a dictionary representation of the class.

def ToString(self) -> str:

Returns a displayable string representation of the class.