Skip to content

Instantly share code, notes, and snippets.

@hannesbe
Last active July 8, 2018 16:49
Show Gist options
  • Select an option

  • Save hannesbe/a7d3bebf9c5375a812752ecce2c02459 to your computer and use it in GitHub Desktop.

Select an option

Save hannesbe/a7d3bebf9c5375a812752ecce2c02459 to your computer and use it in GitHub Desktop.
Gets your spotify playlists (name and uri), useful for configuring a Home Assistant Spotify player (https://community.home-assistant.io/t/spotify-playlist-player/22491). This should work as is on hassio, for other setups change /config/.spotify-token-cache to the actual path of your HA config/.spotify-token-cache
# Gets your spotify playlists (name and uri), useful for configuring a Home Assistant Spotify player (https://community.home-assistant.io/t/spotify-playlist-player/22491).
# This should work as is on hassio, for other setups change /config/.spotify-token-cache to the actual path of your HA config/.spotify-token-cache
HA_SPOTIFY_TOKEN=`cat /config/.spotify-token-cache | jq --raw-output .access_token`
curl -X GET "https://api.spotify.com/v1/me/playlists?offset=0&limit=50" -H "Authorization: Bearer $HA_SPOTIFY_TOKEN" | jq '.items[] | {name: .name, uri: .uri}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment