Skip to content

Instantly share code, notes, and snippets.

@HariSekhon
Last active January 30, 2026 03:54
Show Gist options
  • Select an option

  • Save HariSekhon/fce3f4098537045b33f84ea538f624ca to your computer and use it in GitHub Desktop.

Select an option

Save HariSekhon/fce3f4098537045b33f84ea538f624ca to your computer and use it in GitHub Desktop.
spotify.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowledge-Base

Spotify

https://spotify.com/

Summary

Excellent music streaming platform with ultra low latency instant playing and offline downloads on Premium.

Has Desktop, Mobile and Web players.

I've been using this platform and writing API code for it for about 15+ years.

There are a couple main weaknesses to this platform:

  • Some tracks aren't available due to licensing, leaving you to source and load them yourself into the app, although this is rare
  • Spotify API is not quite complete (misses folder structure)
  • Spotify itself does not respond to community improvement requests and there have been improvement requests open for years for some things

Overall this is still my favourite music platform for the last 15+ years.

Desktop Player

https://www.spotify.com/us/download/

My preferred player as it's slightly more polished and you can have offline downloads on Premium.

Clear Local Spotify Desktop Cache

Close Spotify, delete the cache and then re-open the app.

On Mac:

rm -rf ~/Library/"Application Support"/Spotify/PersistentCache/Storage

On Linux:

rm -rf ~/.cache/spotify/Storage

Desktop Player Automation Code

Spotify Desktop Search

I use the applescript/spotify_app_search.sh script which uses Applescript to automate switching to the desktop app and searching for a given track.

This is used by shazam_search_spotify_then_delete_track.sh to automate searching Shazam'd tracks dumped from the Shazam desktop app's local SQLite DB in the Spotify Desktop app as a workaround to the lack of native Spotify integration with the desktop Shazam app.

Spotify Desktop CLI Automation

In :octocat: HariSekhon/Spotify-tools there is a CLI for the Spotify desktop app to automate common actions such as play/pause/skip tracks, volume up/down, skip through each track after N seconds:

spotify-cmd.pl

I used to use this to skip through tracks automatically every N seconds to scour new tracks.

Mobile Player

Available in the iPhone AppStore and Android Google Play Store.

Web Player

https://open.spotify.com/

Usable immediately from your browser without any installation needed, but the Desktop player is better if you're using it extensively.

Spotify API

The API is fairly good and exposes a lot of information, although not folder structure.

My extensive Spotify API code is available for free publicly (listed further down) to back up and manage playlists, deduplicate, blacklist tracks and more.

My extensive Spotify playlists and filtering through tens of thousands of songs would not be sustainable without this management code.

Spotify API Code

Spotify scripts and API tools can be found in the following repos.

Extensive API code can be found in here:

Readme Card

Some generalization such as a Spotify command line and track name normalization rules can be found here:

Readme Card

Spotify Playlists & Playlist Management Code

Playlist specific management code scripting can be found here:

Readme Card

Playlist Migration Between Different Music Platforms

Playlist2Spotify

https://www.playlist2spotify.com/

You can upload a standard media player .m3u playlist file or paste a list of Artist - Track names for it to generate you the Spotify playlist.

MakeList

https://www.makelist.co/

Generates a Spotify playlist from a URL containing tracks.

You may want to use File Upload Sites to create that URL with a text file of your tracks.

In the case of HariSekhon/Spotify-Playlists I provide these Artist - Track format text files which could be used directly from GitHub by just clicking the Raw link at the top of GitHub's website on any of those files to get the URL with the raw text.

Their counterpart Spotify URI format files are also provided in that repo.

Soundiiz

https://soundiiz.com/

Migrates playlists between music service of your choice, although that requires a paid plan.

The free plan only allows you to create or import playlists but not translate or export them to other platform formats.

I'd personally just write the code to push them to another music service if I wanted to, although if you were only doing a one time migration, paying for a month would be the most time-cost effective way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment