Skip to content

This project provides a simple Python tool to extract track names and artists from a Spotify playlist and save them to a text file.

License

Notifications You must be signed in to change notification settings

SilverHaze99/spotify-playlist-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Spotify Playlist Extractor

This project provides a simple Python tool to extract track names and artists from a Spotify playlist and save them to a text file. It consists of two scripts: one to fetch the playlist data and another to extract the playlist ID from a copied Spotify link.

Features

  • Extracts playlist ID from a Spotify URL in your clipboard.
  • Retrieves all tracks from a playlist, including multiple artists per track.
  • Saves the output as a text file in a Spotify folder on your desktop.
  • Includes progress feedback for large playlists.
  • Handles errors gracefully (e.g., invalid playlist IDs, missing API credentials).

Prerequisites

  • Python 3.x installed.
  • A Spotify Developer account with API credentials (Client ID, Client Secret, Redirect URI).
  • Required Python libraries: spotipy, pyperclip.

Installation

  1. Clone the repository:

    git clone https://github.com/SilverHaze99/spotify-playlist-extractor.git
    cd spotify-playlist-extractor
  2. Install dependencies:

    pip install spotipy pyperclip
  3. Set up Spotify API credentials:

    • Go to the Spotify Developer Dashboard.
    • Create an app to get your CLIENT_ID, CLIENT_SECRET, and set a REDIRECT_URI (e.g., http://localhost:8888/callback).
    • Open SongNameGrabber.py and replace the placeholders:
      CLIENT_ID = "your_client_id_here"
      CLIENT_SECRET = "your_client_secret_here"
      REDIRECT_URI = "your_redirect_uri_here"
    • Alternatively, set these as environment variables:
      export SPOTIPY_CLIENT_ID="your_client_id_here"
      export SPOTIPY_CLIENT_SECRET="your_client_secret_here"
      export SPOTIPY_REDIRECT_URI="your_redirect_uri_here"

Usage

  1. Copy a Spotify playlist URL to your clipboard (e.g., https://open.spotify.com/playlist/4XEb8DUIrlGHBNPRlPtG0W).
  2. Run the extractor script:
    python extract_playlist_id.py
  3. Check the output:
    • A text file (e.g., PlaylistName_Output.txt) will be created in ~/Desktop/Spotify/.
    • The file contains tracks in the format: Song Name - Artist1, Artist2.

Example Output

Playlist-ID: 4XEb8DUIrlGHBNPRlPtG0W
Fetching tracks... 0 loaded so far.
Fetching tracks... 100 loaded so far.
The playlist data was saved in 'C:\Users\YourName\Desktop\Spotify\PlaylistName_Output.txt'.

Files

  • SongNameGrabber.py: Fetches playlist data from Spotify and saves it to a file. Can be used standalone with a playlist ID as an argument (python SongNameGrabber.py <playlist_id>).
  • extract_playlist_id.py: Extracts the playlist ID from a Spotify URL in your clipboard and runs SongNameGrabber.py.

Possible Improvements

  • Add support for custom output directories.
  • Include album names or track durations in the output.
  • Create a single-script version for simplicity.

Contributing

Feel free to fork this repository, submit issues, or send pull requests with improvements!

License

This project is licensed under the terms of the MIT license. See LICENSE for details.

Disclaimer

This tool uses the Spotify Web API but is not affiliated with or endorsed by Spotify.


About

This project provides a simple Python tool to extract track names and artists from a Spotify playlist and save them to a text file.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages