A browser-console JavaScript utility for extracting the complete track list from a Spotify playlist.
Spotify's web player uses lazy loading and virtualized playlist rows, which means only a portion of a large playlist may exist in the DOM at any given time. This script automatically scrolls through the playlist, collects visible tracks, removes duplicates, and generates a complete text list.
- Extracts tracks from large Spotify playlists
- Handles Spotify's virtualized playlist interface
- Automatically scrolls through the playlist
- Collects track titles and artists
- Removes duplicate tracks using Spotify track URLs
- Preserves the order in which tracks are encountered
- Copies the final result to the browser clipboard
- Requires no external libraries or installations
- Runs directly inside the browser Developer Console
This script gives you a simple way to extract track names and artist names from a playlist and keep them as a clean track list.
Once you have this information, you can use it for many different purposes, such as:
- Keeping a backup of your playlist's track list
- Creating a clean and portable list of your music
- Finding the same tracks from other sources
- Downloading tracks from legal and freely available sources
- Using the extracted information in other music-related tools or projects
- Processing, organizing, or managing your music collection
- Building your own workflows around the extracted metadata
The extracted information is yours to use as the basis for whatever legal purpose you need.
- A desktop browser
- Spotify Web Player
- Access to the playlist you want to extract
- Browser Developer Tools
The script is intended for Spotify's current web player interface and may require changes if Spotify modifies its DOM structure.
- Open Spotify Web Player in your browser.
- Open the playlist you want to extract.
- Open Developer Tools.
For Chromium-based browsers, you can usually press:
F12
or:
Ctrl + Shift + J
- Open the
Consoletab. - Paste the script from this repository into the console.
- Run it.
- Wait while the script scrolls through the playlist and collects tracks.
- When extraction is complete, the console will display the total number of tracks found.
The extracted result is also stored in:
window.spotifyPlaylistResultTo copy the result to your clipboard, run:
navigator.clipboard.writeText(spotifyPlaylistResult)The generated output follows this format:
1. Track Name — Artist
2. Track Name — Artist
3. Track Name — Artist
For tracks with multiple artists:
1. Track Name — Artist One, Artist Two
The script identifies the scrollable container used by Spotify's playlist interface.
It then repeatedly:
- Collects currently visible playlist rows.
- Finds Spotify track URLs.
- Extracts the track title.
- Extracts the associated artist names.
- Uses the track URL as a unique identifier.
- Scrolls further down the playlist.
- Repeats the process until the bottom of the playlist is reached.
Because Spotify dynamically renders playlist rows, collecting tracks only once with querySelectorAll() may return an incomplete list. The continuous scrolling approach allows the script to capture tracks as they are rendered.
Tracks are stored in a JavaScript Map.
The Spotify track URL is used as the unique identifier:
const trackId = trackLink.href.split("?")[0];This prevents the same track from being added multiple times while the playlist is being scrolled.
This script depends on Spotify's current web-player DOM structure.
Spotify may change:
- Element attributes
- Playlist row structure
- Scroll containers
- Track link structure
- Artist link structure
If Spotify changes its interface, the selectors used by the script may need to be updated.
The script extracts information available in the Spotify Web Player interface. It does not access Spotify's private APIs or modify the playlist.
The script runs locally in the browser.
It does not send the extracted playlist data to an external server.
The extracted data remains available in the current browser page through:
window.spotifyPlaylistResultRefreshing or closing the page will remove this variable.
spotify-playlist-extractor/
├── README.md
└── spotify-playlist-extractor.js
Copyright (c) 2026 Behnood Shafiei (Behnooddev) (VoidRoot)
Developer: Behnood Shafiei
This project is provided for personal and educational use.
This project is an independent browser-side utility and is not affiliated with or endorsed by Spotify.
Use the tool in accordance with Spotify's Terms of Use and applicable laws.