SpotMusic - Python Script icon

SpotMusic - Python Script

Hot or Not
SpotMusic - Python Script

Description

Hi, This is the software for downloading songs from Spotify. You can download song from your playlist or entire playlist in just one click. It comes with a login interface from spotify which will help you to login your spotify account into it.聽 I have used oath of spotify for login. You must know that you have to get the spotify client and secret key. You can easily get these keys from spotify. Just go to their website for developers Save the key in .env files and then use loadenv and os.getenv() for accessing it.

HERE IS THE LINK:-https://developer.spotify.com/

Working of the Code:-

Spotify does not allow to download the songs to your storage. However, this code does not directly download the songs from spotify. It gets the song info using spotify api and then download it from youtube (as most of the spotify songs are available in youtube). It has it own disadvantages but it works. I used yt_dlp for this work.

You must install yt_dlp and ffmpeg before running the program ffmpeg is a fundamental requirement for yt_dlp to deal with sounds.聽 link:- https://ffmpeg.org/download.ht...聽

I have also made the GUI. I used customtkinter for GUI. So, it will work smoothly. Login ,Logout , Download from playlist are some of the buttons are there.

I hope this code will be helpful for you.

Features

Key Components:

  • GUI (customtkinter): The program has a clean and modern user interface that allows you to log in to your Spotify account, browse your playlists, and download songs.
  • API Integration:
    • Spotify: It uses the spotipy library to authenticate your Spotify account, retrieve your playlists, and get track information (song title and artist).
    • YouTube: It uses youtubesearchpython to find the most relevant YouTube video for a given song and artist, and yt_dlp to download the audio from that video.
  • Configuration Management: It automatically creates a SpotMusic folder in your user's AppData directory (on Windows) to store configuration and download path information.
  • Portability: The resource_path function suggests the program is intended to be packaged into a standalone executable using tools like PyInstaller.

Requirements

Requirements

Before you can use this program, you need to set up your environment and obtain API credentials.

1. Python Libraries

You must have the following Python libraries installed. You can install them using pip, Python's package manager:

pip install customtkinter spotipy yt-dlp youtubesearchpython python-dotenv pillow requests


2. FFmpeg

This program requires FFmpeg, a free software project that handles multimedia files. yt-dlp uses FFmpeg to convert the downloaded audio into an MP3 file. You can download and install FFmpeg from the official website. The process varies depending on your operating system: On Windows:

  1. Go to the FFmpeg download page.
  2. Follow the instructions to download a pre-built executable for Windows. A common source is the gyan.dev build.
  3. Extract the downloaded ZIP file to a location on your computer, such as C:FFmpeg.
  4. You must then add the bin folder (e.g., C:FFmpegbin) to your system's PATH environment variables. This allows the program to find the FFmpeg executable from any directory.

On macOS: The easiest way to install FFmpeg is by using a package manager like Homebrew. If you don't have Homebrew installed, you can find the instructions on their official website. Open your terminal and run the following command:

brew install ffmpeg


On Linux (Debian/Ubuntu): Use your system's package manager to install FFmpeg. Open a terminal and run:

sudo apt update
sudo apt install ffmpeg


3. Spotify Developer Account

You need a Spotify Developer account and API credentials to use the program. Follow these steps:

  1. Go to the Spotify Developer Dashboard.
  2. Log in with your Spotify account.
  3. Click "Create an app" and provide a name and description.
  4. Once the app is created, go to the "Settings" of your new app.
  5. Click "Edit Settings."
  6. In the "Redirect URIs" section, add a new URI. For this program, you can use http://localhost:8888/callback.
  7. Save the settings.
  8. Now, on the app's main page, you will see the Client ID and Client Secret. Keep these handy.

4. .env File

The program uses environment variables to securely store your Spotify credentials. You need to create a file named .env in the same directory as the Python script. Add the following lines to your .env file, replacing the placeholder values with your own Client ID, Client Secret, and Redirect URI:

CLIENT_ID="YOUR_CLIENT_ID"
CLIENT_SECRET="YOUR_CLIENT_SECRET"
REDIRECT_URI="http://localhost:8888/callback"

Instructions

Once you have completed the setup, you are ready to use the program.

1. Running the Program

Navigate to the directory containing the SpotMusic.py file in your terminal and run the following command:

python SpotMusic.py


A graphical window will appear.

2. Logging in to Spotify

To download songs from your playlists, you must log in. Click the "Login With Your Spotify Account" button. A web browser window will open, prompting you to log in to your Spotify account and grant permission to the application. After you grant permission, the program will log you in, and your username will be displayed on the main screen.

3. Downloading a Single Song

  1. On the main screen, enter a Spotify song link in the text box.
  2. Click the "Download this song" button. The program will find the song on YouTube and begin the download. A confirmation message will appear once it's complete.

4. Downloading from Your Playlist

  1. Click the "Download Songs from Your Playlist" button.
  2. A new screen will appear with a dropdown menu displaying all your Spotify playlists.
  3. Select a playlist from the dropdown. The program will display the playlist's cover art and the option to select individual songs.
  4. You can either select a specific song from the "Select a Song" dropdown to download it individually or click the "Download Full Playlist" button to download all songs from the selected playlist.
AuthorSPCoder
CategoryScripts & Code / Python
Price$25
Extended License$75
Likes2
First ReleaseSep 14, 2025
Last UpdateSep 17, 2025

External listing. code.market does not sell this product and does not process payment for it. Pricing, payment, delivery, licensing, refunds, and support are handled by the third-party merchant on its own website. We may earn an affiliate commission from a referral. Details.

Products of the Week.

Submit
SpotMusic - Python Script | Code Market