Migrate your Spotify Liked Songs to YouTube Music automatically.
Features · Quick Start · Auth Methods · Scripts · Configuration · Tech Stack
Miggrer reads your Spotify Liked Songs CSV export, searches for each track on YouTube Music, and adds matching songs to a new playlist called "Liked Songs (Spotify)" — fully automatic with retry logic, batch processing, and crash-safe resume.
| Feature | Description |
|---|---|
| Spotify CSV Import | Reads your liked songs from a standard Spotify CSV export |
| YouTube Music Search | Automatically finds matching tracks on YouTube Music |
| Playlist Creation | Creates a "Liked Songs (Spotify)" playlist if it doesn't exist |
| Batch Processing | Saves tracks in batches of 10 to reduce API calls |
| Retry with Backoff | Retries failed tracks up to 3 times with exponential backoff |
| Auto Token Refresh | Refreshes SAPISIDHASH authorization every 120 seconds |
| Crash-Safe Resume | Persists processed tracks to resume after interruption |
| Two Auth Methods | Choose between Browser/Cookie or OAuth authentication |
git clone https://github.com/Beno-Goulart/Miggrer.git
cd Miggrerpip install -r requirements.txt- Go to Spotify Account Data
- Request an "Account data" download
- Find the
Liked_SongsCSV inside the exported ZIP - Place it in the project root
Choose one method: Browser/Cookie or OAuth.
# Cookie-based migration
python src/migrador.py
# OAuth-based migration (with resume support)
python src/migrador_oauth.pyUses cookies from your browser session. Simpler to set up, but tokens expire.
- Log into YouTube Music in Chrome
- Open DevTools (
F12) → Network tab - Reload the page, click any request to
music.youtube.com - Copy the raw request headers
- Run the interactive updater:
python src/utils/atualizar_browser.py- Paste the headers when prompted, press Enter twice to finish
This generates data/browser.json with the required authentication credentials.
Uses Google OAuth2. More robust, supports automatic token refresh.
- Create a Google Cloud project
- Enable the YouTube Data API v3
- Create OAuth 2.0 credentials (Desktop app type)
- Set environment variables:
# Windows PowerShell
$env:GOOGLE_CLIENT_ID="your_client_id"
$env:GOOGLE_CLIENT_SECRET="your_client_secret"
# Linux/macOS
export GOOGLE_CLIENT_ID="your_client_id"
export GOOGLE_CLIENT_SECRET="your_client_secret"Or copy .env.example to .env and fill in the values.
- Run the OAuth setup:
python src/utils/setup_oauth.py- A browser window opens — authorize with your Google account
- Credentials are saved to
data/oauth.json
| Script | Description |
|---|---|
src/migrador.py |
Main migration script using browser cookie auth |
src/migrador_oauth.py |
Alternative migration using OAuth (with crash-safe resume) |
src/utils/setup_oauth.py |
One-time OAuth token generator |
src/utils/gerar_headers.py |
Generates browser.json from raw headers |
src/utils/atualizar_browser.py |
Interactive CLI tool to update browser.json from DevTools |
| Variable | Description |
|---|---|
GOOGLE_CLIENT_ID |
Your Google Cloud OAuth 2.0 client ID |
GOOGLE_CLIENT_SECRET |
Your Google Cloud OAuth 2.0 client secret |
| File | Purpose |
|---|---|
data/browser.json |
YouTube Music browser auth credentials (cookie-based) |
data/oauth.json |
OAuth token (generated by setup_oauth.py) |
data/processed.json |
Tracks already migrated (auto-managed, enables resume) |
Miggrer/
├── src/
│ ├── migrador.py # Main migrator (cookie auth)
│ ├── migrador_oauth.py # Alternative migrator (OAuth auth)
│ └── utils/
│ ├── setup_oauth.py # OAuth setup helper
│ ├── gerar_headers.py # Browser JSON generator
│ └── atualizar_browser.py # Interactive header updater
├── data/
│ ├── browser.json # Browser auth credentials (gitignored)
│ ├── oauth.json # OAuth token (gitignored)
│ └── processed.json # Migrated tracks (gitignored)
├── docs/
│ └── logo.png
├── .env.example
├── .gitignore
├── requirements.txt
└── README.md
| Component | Technology |
|---|---|
| Language | Python 3.7+ |
| YouTube Music API | ytmusicapi |
| Auth (Browser) | Cookie-based SAPISIDHASH |
| Auth (OAuth) | Google OAuth 2.0 |
| CSV Parsing | Python csv (stdlib) |
| Data Storage | JSON files |
MIT — use it, fork it, migrate it.
