mirror of
https://github.com/mirrorfm/spotify-private-api.git
synced 2026-04-26 03:35:48 +03:00
No description
|
|
||
|---|---|---|
| .github/workflows | ||
| app | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| Makefile | ||
| README.md | ||
unofficial-spotify-api
Go client for Spotify's internal API endpoints not available in the public Web API.
Used by mirror.fm to reorder playlists in a user's library.
Usage
Requires a web player access token obtained via spotify-webplayer-token and a SPOTIFY_USER_ID env var.
import (
webPlayer "github.com/mirrorfm/spotify-webplayer-token/app"
api "github.com/mirrorfm/unofficial-spotify-api/app"
)
func main() {
token, _ := webPlayer.GetAccessTokenFromEnv()
userId, _ := api.GetUserIdFromEnv()
// Get all playlists in their current display order
rootList, status, _ := api.GetRootList(token.AccessToken, userId)
// Reorder playlists
ops := api.DeltaOps{
Kind: "MOV",
Mov: api.OpsMov{FromIndex: 5, Length: 1, ToIndex: 0},
}
api.PostRootListChanges([]api.DeltaOps{ops}, rootList.Revision, token.AccessToken, userId)
}
API endpoints
GET /playlist/v2/user/{userId}/rootlist
Returns all playlists in their current display order with revision info.
POST /playlist/v2/user/{userId}/rootlist/changes
Reorder playlists by submitting move operations against a base revision.