This tool by Darryl Mathias was inspired by the many Python-based music downloaders out there and my personal pain for not being able to download (sigh) :( — so I built a full JavaScript version for all my fellow JS fans.
It automatically fetches public Spotify playlist tracks, finds the best YouTube match, and downloads them as MP3s with metadata and cover art using yt-dlp and ffmpeg.
- Connects to Spotify Web API for playlist data
- Searches YouTube using accurate track + artist names
- Downloads high-quality
.mp3audio with:- Album art (via
--embed-thumbnail) - Metadata (track name, artist)
- Album art (via
| Tool | Description | Install |
|---|---|---|
| Node.js | Runtime for the script | Download |
| yt-dlp | Downloader from YouTube (and more) | Download executable |
| ffmpeg | For audio extraction & thumbnail embed | Download here (ffmpeg-release-essentials.zip) |
Don't forget to add them to your environment variables.
To use this tool, you'll need to authenticate with Spotify via the Client Credentials Flow. This requires:
This step was not possible to skip (which was the original plan), so follow this guide to get two metrics,
- Client ID
- Client Secret
-
Clone the repo
git clone https://github.com/DarrylMathias/Spotify-mp3-downloader.git cd spotify-mp3-downloader -
Install dependencies
npm install
-
Create .env file
Sample .env file :
CLIENT_ID=your_spotify_client_id CLIENT_SECRET=your_spotify_client_secret PLAYLIST_LINK=your_spotify_playlist_link DOWNLOAD_PATH=C:\Users\yourname\Music\Downloads
How to get the PLAYLIST_LINK:
In Spotify, right-click the playlist → “Share” → “Copy Link to Playlist”.

-
Run script
node script.js
- Retrieves Spotify playlist data (track names, artists, and IDs)
- For each track in the playlist:
- Searches YouTube using a combination of the track name and artist(s)
- Downloads the best-matching video using
yt-dlpin.mp3format - Embeds metadata and thumbnail using
ffmpegviayt-dlpflags
This project is provided for educational and personal archival use only.
-
YouTube’s Terms of Service prohibit downloading content without explicit permission.
-
This script accesses YouTube using yt-dlp, which may bypass restrictions (like age-gates or region locks) — this is against YouTube's terms.
-
You must own or have permission to download any content processed by this tool.
-
Redistribution, resale, or public hosting of downloaded content is a violation of copyright law in many countries.
-
The developer of this tool is not liable for misuse or violation.
Use responsibly, and always respect content creators.
You can also further enhance this project by creating a CRON job that on a daily basis, checks for any changes in the API and downloads the songs accordingly. ✨