Useful when changing your Spotify account — automatically transfers your liked songs.
🇵🇱 Polska wersja poniżej
- Export liked songs from your old account to CSV
- Run the script on your new account
- The script adds all tracks to your liked songs
Go to https://exportify.net/, log in with your old account and download Liked Songs as CSV.
Save the file as Liked_Songs.csv in the project directory.
- Go to https://developer.spotify.com/dashboard/create
- Fill in the form (name and description can be anything)
- In the Redirect URIs field enter exactly:
http://127.0.0.1:8888/callback - Under APIs used check only: Web API ✅
(Web Playback SDK, Android, iOS, Ads API — not needed) - Save and go to app settings — copy your Client ID and Client Secret
Copy the example file and fill in your credentials:
cp env.example .envEdit .env:
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
SPOTIFY_REDIRECT_URI=http://127.0.0.1:8888/callback
CSV_FILE=Liked_Songs.csvpip install spotipy pandas python-dotenvpython3 spotify_import_with_credentials.pyOn first run a browser window will open asking you to authorize.
After logging in you'll be redirected to http://127.0.0.1:8888/callback — that's expected.
Spotipy caches the token in a .cache file. If the token expired or the app credentials changed, the refresh fails.
Fix: delete the cache and re-run:
rm -f .cache && python3 spotify_import_with_credentials.pyYou'll be prompted to log in again via the browser.
Copy the URL printed in the terminal and paste it manually into your browser.
Make sure .env and .cache are in .gitignore — don't push credentials to GitHub:
.env
.cache
Przydatne przy zmianie konta Spotify — automatycznie przenosi polubione utwory.
- Eksportujesz polubione utwory ze starego konta do CSV
- Uruchamiasz skrypt na nowym koncie
- Skrypt dodaje wszystkie utwory do polubionych
Wejdź na https://exportify.net/, zaloguj się starym kontem i pobierz Liked Songs jako CSV.
Zapisz plik jako Liked_Songs.csv w katalogu projektu.
- Wejdź na https://developer.spotify.com/dashboard/create
- Wypełnij formularz (nazwa i opis dowolne)
- W polu Redirect URIs wpisz dokładnie:
http://127.0.0.1:8888/callback - W sekcji APIs used zaznacz tylko: Web API ✅
(Web Playback SDK, Android, iOS, Ads API — nie są potrzebne) - Zapisz i wejdź w ustawienia aplikacji — skopiuj Client ID i Client Secret
Skopiuj plik przykładowy i uzupełnij swoje dane:
cp env.example .envEdytuj .env:
SPOTIFY_CLIENT_ID=tutaj_wklej_client_id
SPOTIFY_CLIENT_SECRET=tutaj_wklej_client_secret
SPOTIFY_REDIRECT_URI=http://127.0.0.1:8888/callback
CSV_FILE=Liked_Songs.csvpip install spotipy pandas python-dotenvpython3 spotify_import_with_credentials.pyPrzy pierwszym uruchomieniu otworzy się przeglądarka z prośbą o autoryzację.
Po zalogowaniu zostaniesz przekierowany na http://127.0.0.1:8888/callback — to normalne.
Spotipy cache'uje token w pliku .cache. Jeśli token wygasł lub dane aplikacji się zmieniły, odświeżenie nie działa.
Rozwiązanie: usuń cache i uruchom ponownie:
rm -f .cache && python3 spotify_import_with_credentials.pyZostaniesz poproszony o ponowne zalogowanie przez przeglÄ…darkÄ™.
Skopiuj URL wypisany w terminalu i wklej go ręcznie do przeglądarki.
Upewnij się, że .env i .cache są w .gitignore — nie wrzucaj credentiali na GitHub:
.env
.cache