spotify

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: GPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package spotify implements search using Spotify's desktop search service. Requests use the embedded player's access and client tokens.

Index

Constants

View Source
const BaseURL = "https://api-partner.spotify.com/pathfinder/v2/query"

BaseURL is the desktop query service.

Variables

This section is empty.

Functions

func Cover

func Cover(images []Image, px int) string

Cover is the URL of the smallest of images at least px wide, or the largest when none is ("": none).

Types

type Album

type Album = catalog.Album

type AlbumDetails

type AlbumDetails = catalog.AlbumDetails

type Artist

type Artist = catalog.Artist

type ArtistOverview

type ArtistOverview = catalog.ArtistOverview

type Client

type Client struct {
	Token       func(context.Context) (string, error)
	ClientToken func(context.Context) (string, error)
	HTTP        *http.Client
	Base        string // complete endpoint; "": BaseURL
	Now         func() time.Time
	// contains filtered or unexported fields
}

Client calls the desktop search service. Token supplies an access token (the player's); it is asked once per tokenLife and again when Spotify rejects one.

func (*Client) Album

func (c *Client) Album(ctx context.Context, uri string) (AlbumDetails, error)

Album follows every bounded album page, preserving unavailable item slots.

func (*Client) Artist

func (c *Client) Artist(ctx context.Context, uri string) (ArtistOverview, error)

Artist loads the Spotify artist overview and its popular tracks from the same query Spotify uses for artist pages.

func (*Client) Home

func (c *Client) Home(ctx context.Context) (HomeFeed, error)

Home reads Spotify's own personalized Home shelves. sectionItemsLimit is deliberately bounded to keep the response small.

func (*Client) LikedTracks

func (c *Client) LikedTracks(ctx context.Context, offset, limit int) (SavedTracksPage, error)

LikedTracks returns one bounded page of the user's Liked Songs.

func (*Client) Reset

func (c *Client) Reset()

Reset forgets account-specific authentication and rate limits. A token request already in flight cannot repopulate the cache after this call.

func (*Client) Search

func (c *Client) Search(ctx context.Context, q string, limit int) (Results, error)

Search looks q up across tracks, albums, artists, and playlists.

type Error

type Error struct {
	Status     int
	RetryAfter string
	Message    string
}

Error is a Spotify service failure.

func (Error) Error

func (e Error) Error() string

func (Error) HTTPStatus

func (e Error) HTTPStatus() int

func (Error) RetryAfterValue

func (e Error) RetryAfterValue() string

type HomeFeed

type HomeFeed = catalog.HomeFeed

type HomeItem

type HomeItem = catalog.HomeItem

type HomeSection

type HomeSection = catalog.HomeSection

type Image

type Image = catalog.Image

type Playlist

type Playlist = catalog.Playlist

type Results

type Results = catalog.Results

Results are what a search found.

type SavedTrack

type SavedTrack = catalog.SavedTrack

SavedTrack is a track in the user's Liked Songs collection. AddedAt is zero when the service does not include a saved timestamp for that item.

type SavedTracksPage

type SavedTracksPage = catalog.SavedTracksPage

SavedTracksPage is one bounded page of Liked Songs. Total is Spotify's reported collection size; Items preserves one slot per returned raw item, including entries whose metadata is unavailable.

type Track

type Track = catalog.Track

Track is the search metadata used by the app.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL