This simple Python script automates downloading songs from Spotify playlists using the spotdl library.
- Python 3: Download and install the latest Python version from www.python.org/downloads/
- spotdl: github.com/spotDL/spotify-downloader
-
Install the
spotdllibrary:pip install spotdl
-
Input links to the 'links.txt' file: Place the links to Spotify songs/albums/playlists in this file, one link per line.
Run the script from your terminal:
python main.pyIf prompted
FFmpeg is already installed. Do you want to overwrite it? (y/N):-
Type
yand pressEnterto download the latest version of FFmpeg. -
Type
Nand pressEnterto use the existing FFmpeg installation.If you get the following error:
OSError: [WinError 193] %1 is not a valid Win32 application
Go back to option 1 and overwrite the existing FFmpeg installation.
The script does the following:
- Imports the
osmodule: Used for interacting with the operating system (changing directories, running commands). - Downloads ffmpeg (if not present): Ensures that
spotdlhas its necessary dependency. - Reads the
links.txtfile: Iterates through each Spotify playlist link. - Downloads songs using
spotdl: Uses thespotdllibrary to download the tracks from each playlist.