Skip to content

Latest commit

 

History

History
95 lines (56 loc) · 1.97 KB

File metadata and controls

95 lines (56 loc) · 1.97 KB
🎵 Spotify Playlist Data Extractor (Python + Spotify API) This project extracts detailed track information and audio-features from any Spotify playlist using the Spotify Web API and saves the results into a clean CSV file. It demonstrates: Authentication using Client ID & Client Secret Calling Spotify’s REST API using requests Extracting playlist tracks Fetching audio features (danceability, energy, tempo, valence) Processing JSON responses Converting data to pandas DataFrame Exporting final dataset to CSV 🚀 Features ✔ Fetch song names ✔ Extract artist names ✔ Extract album name ✔ Get track IDs ✔ Fetch audio features: Danceability Energy Tempo Valence ✔ Save everything to a CSV file ✔ Beginner-friendly code structure 📂 Project Structure spotify-playlist-data-extractor/ │ ├── spotify_data.py # Main script ├── requirements.txt # Dependencies ├── README.md # Project documentation └── spotify_playlist_data.csv # Output (generated after running) 🛠 How to Run 1️⃣ Install Dependencies pip install -r requirements.txt 2️⃣ Add Your Spotify App Credentials In spotify_data.py, update: client_id = "YOUR_CLIENT_ID" client_secret = "YOUR_CLIENT_SECRET" 3️⃣ Add your playlist ID Example: playlist_id = "7BuvfypYh3pleYapkuq1tx" 4️⃣ Run the Script python spotify_data.py 5️⃣ Output File A CSV file named: spotify_playlist_data.csv will be generated in your project folder. 🧠 How It Works (Simple Explanation) Your Spotify Client ID + Secret are encoded for authentication Spotify API returns a temporary token Using the token, the script loads a playlist For every track: The script extracts basic info Calls audio-feature API Everything is combined into a pandas DataFrame The result is saved as CSV# Data_collection_with_API-Spotify-