Script Python pour créer une playlist Spotify depuis un fichier CSV.
-
Créer une app sur Spotify Developer Dashboard
- Récupérer le Client ID et le Client Secret
- Ajouter
http://127.0.0.1:8888/callbackdans les Redirect URIs
-
Installer les dépendances :
pip install spotipy python-dotenv
Copier .env.example en .env et renseigner vos credentials :
cp .env.example .envSPOTIPY_CLIENT_ID=your_client_id_here
SPOTIPY_CLIENT_SECRET=your_client_secret_here
SPOTIPY_REDIRECT_URI=http://127.0.0.1:8888/callbackLe fichier CSV doit contenir deux colonnes : titre et artiste.
titre,artiste
Paranoid,Black Sabbath
Master of Puppets,Metallicapython3 create_spotify_playlist.py <fichier.csv>Le script demande interactivement :
- Le nom de la playlist
- La description
- La visibilité (publique ou privée)
Un navigateur s'ouvre pour l'authentification Spotify à la première utilisation.
$ python3 create_spotify_playlist.py example_playlist.csv
Nom de la playlist : Best Of 2026
Description : Ma sélection de l'année
Publique ? (o/n) : n
Connecté en tant que : john
✓ Trouvé : Paranoid — Black Sabbath
✗ Introuvable : Some Obscure Track — Unknown Band
...
42 titres ajoutés sur 43.