Fork me on GitHub

Spotify Playlist Generator

Create Playlist




To import the playlist into Spotify:

  1. Copy the output of the generator: Choose Edit -> Copy (Ctrl + C).
  2. Create a new playlist in Spotify: Choose File -> New Playlist (Ctrl + N).
  3. Paste into the playlist: Select the playlist and choose Edit -> Paste (Ctrl + V).

Top tracks

To retrieve the top 10 tracks of an artist, pass the following to the generator:

#top Aphex Twin

The generator will output a playlist consisting of the ten most popular tracks of Aphex Twin, which can then be imported into Spotify.

All of the directives listed here can be used multiple times. For example:

#top Aphex Twin
#top Beach House

This will create a playlist consisting of the top tracks of Aphex Twin, followed by the top tracks of Beach House.

To retrieve only the top 5 tracks, use #top5.

Similar artists

To find similar artists:

#similar Aphex Twin

This will generate a 100-track playlist consisting of the 5 most popular tracks from the 20 most similar artists to Aphex Twin.

To retrieve more tracks, use #similar10.


To add an album:

#album Substrata - Biosphere


To add all the albums of an artist:

#artist Beach House


To add a single track to the playlist, add a line on the form TITLE - ARTIST:

Walk in the Park - Beach House
Irene - Beach House
Other People - Beach House
Troublemaker - Beach House
Wishes - Beach House


By default, the generator automatically removes duplicate tracks. To allow duplicates, add the line:



To order the tracks by Spotify popularity, use #order by:

#order by popularity
#artist Beach House

The generator also provides support. To order by playcount, add the line #order by lastfm:

#order by lastfm
#artist Beach House

To order by user playcount, add the username at the end:

#order by lastfm username
#artist Beach House


To sort the ordered tracks into groups, use #group by:

#order by lastfm
#group by artist
#similar Beach House

This will create a playlist of artists similar to Beach House, where tracks from the same artists are grouped together.


To group the tracks and then interleave them, use #alternate by:

#order by popularity
#alternate by artist
#similar Beach House
#similar Hooverphonic

This will create a playlist of artists similar to Beach House and Hooverphonic, with each track having a different artist from the previous track.

Supported formats

The generator can work with Spotify URIs, Spotify links, M3U playlists and CSV files. By default, the generator outputs a list of Spotify URIs.

Import existing Spotify playlists

One can easily work with existing Spotify playlists. By selecting the playlist’s tracks in Spotify, copying them and then pasting them as text somewhere else, one obtains a list of Spotify links:

One can easily apply #order by popularity to such a list:

#order by popularity

Likewise, spotify URIs are handled as well:

#order by popularity
#alternate by album

M3U playlists

One can also import M3U playlists (with the file extension .m3u or .m3u8), provided they contain EXTM3U metadata. That is, the playlist should be on the form:

#EXTINF:404,Desire Lines - Deerhunter
Deerhunter/Halcyon Digest/06 Desire Lines.mp3
#EXTINF:230,Saved By Old Times - Deerhunter
Deerhunter/Microcastle/10 Saved By Old Times.mp3
#EXTINF:202,Agoraphobia - Deerhunter
Deerhunter/Microcastle/02 Agoraphobia.mp3
#EXTINF:133,Revival - Deerhunter
Deerhunter/Halcyon Digest/03 Revival.mp3
#EXTINF:264,Twilight at Carbon Lake - Deerhunter
Deerhunter/Microcastle/12 Twilight at Carbon Lake.mp3

The generator translates this to:

Desire Lines - Deerhunter
Saved By Old Times - Deerhunter
Agoraphobia - Deerhunter
Revival - Deerhunter
Twilight at Carbon Lake - Deerhunter

Comma-separated values

The generator can read and write the CSV format used by Exportify:

spotify:track:3jZ0GKAZiDMya0dZPrw8zq,Desire Lines,Deerhunter,Halcyon Digest,1,6,404413,,
spotify:track:20DDHYR4vZqDwHyNFLwkXI,Saved By Old Times,Deerhunter,Microcastle,1,10,230226,,
spotify:track:30wvVTkqA4Fp5ZCG0xGof7,Revival,Deerhunter,Halcyon Digest,1,3,133666,,
spotify:track:6vtwbm7YGkTwTINdrcXV5I,Twilight At Carbon Lake,Deerhunter,Microcastle,1,12,263986,,

To output to this format, add the line #csv:

Desire Lines - Deerhunter
Saved By Old Times - Deerhunter
Agoraphobia - Deerhunter
Revival - Deerhunter
Twilight at Carbon Lake - Deerhunter

CSV files have the advantage of being editable with a spreadsheet editor such as Microsoft Excel or LibreOffice Calc. They are also future-proof, as they contain additional info to the Spotify URIs (which might change).

Command-line script

A command-line version is also available. It requires Node to be installed.

The source code is located at GitHub. To clone the repository:

$ git clone

Alternatively, download a ZIP file.

Run the script with ./index.js or node index:

$ ./index.js input.txt output.txt