This is a simple command-line utility written in Python for downloading most Spotify images accessible through the Spotify Web API. API access requires a Spotify application, which in turn requires a user account. Follow the Setup instructions below.
This tool requires Python 3 (3.8+ is preferable). Download the code with git clone
or with Download ZIP
(accessible with the green Code
button).
-
Create a virtual environment (optional).
-
Run the command:
pip install -r requirements.txt
- Package the script with PyInstaller (optional).
-
Register a Spotify account. If you are seeking to use this tool, then chances are, you already have one.
-
Go to the Spotify Developer Dashboard, and create a new application.
-
Populate the
App name
,App description
, andRedirect URI
fields. TheRedirect URI
field may be set tohttp://localhost:3000
, for example. -
Select the
Web API
to be used. -
Read and agree to the Developer Terms of Service. Save the application.
-
Go to the application settings. You need the information here for the initial use of the script.
Copy the Client ID
and paste it in place of CLIENT_ID
in the command below. Copy the Client secret
and paste it in place of CLIENT_SECRET
in the command below. Then go to Spotify and copy the URL of an artist, an album, a playlist, a user, or a track. Paste it in place of URL
in the command below.
python spotify-image-downloader.py URL --client-id CLIENT_ID --client-secret CLIENT_SECRET
After the command completes successfully, --client-id
and --client-secret
need not be passed in subsequent runs, unless a change is desired or necessary.
usage: spotify-image-downloader [-h] [-o OUTPUT] [--client-id CLIENT_ID] [--client-secret CLIENT_SECRET] [--one-time] [--clear] id
Simple command-line utility to download images for Spotify artists, albums, playlists, users, and tracks.
positional arguments:
id URL or URI of the Spotify resource.
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output file.
authorization:
--client-id CLIENT_ID
Spotify client ID. Only required on first run.
--client-secret CLIENT_SECRET
Spotify client secret. Only required on first run.
--one-time Use the provided authorization without overwriting the saved configuration.
--clear Removes the current saved Spotify client configuration.
Pass --one-time
along with the Spotify application information to use the provided information without overwriting the configuration saved in the 'config' file.
Pass --clear
to delete the saved configuration from the 'config' file and then exit.
Downloading an image from a Spotify URL:
python spotify-image-downloader.py "https://open.spotify.com/artist/0CGpNBihXlpMsjwHjVKNIO"
Downloading an image from a Spotify URI:
python spotify-image-downloader.py "spotify:artist:0CGpNBihXlpMsjwHjVKNIO"
Specifying a custom output file:
python spotify-image-downloader.py "spotify:artist:0CGpNBihXlpMsjwHjVKNIO" --output "./images/artist.jpg"