A Python CLI tool to migrate your playlists and albums from Spotify to YouTube Music with smart track matching.
- Export playlists from Spotify
- Smart track matching using ISRC codes and fuzzy search
- Migrate individual or all playlists
- Duplicate playlist name handling with interactive resolution
- Real-time progress indicators with track-by-track updates
- Detailed migration reports with success rates
- Export reports to JSON/CSV formats
- Privacy settings (public/private playlists)
- Album migration (coming soon)
- Python 3.10+
- Poetry (for dependency management)
- Spotify Developer Account (free)
- YouTube Music Account
cd /path/to/spotify-to-ytmusic
poetry install- Go to Spotify Developer Dashboard
- Click "Create App"
- Fill in the app details:
- App name: "Spotify to YT Music Migrator" (or any name)
- Redirect URI:
http://localhost:8888/callback
- Copy your Client ID and Client Secret
# Copy the example environment file
cp .env.example .env
# Edit .env and add your Spotify credentials
# SPOTIFY_CLIENT_ID=your_client_id_here
# SPOTIFY_CLIENT_SECRET=your_client_secret_here# Run the setup command to authenticate with YouTube Music
poetry run spotify-to-ytmusic setup-ytmusic
# Follow the prompts to copy browser headers for authentication# See all your Spotify playlists
poetry run spotify-to-ytmusic list-playlists
# Migrate a specific playlist
poetry run spotify-to-ytmusic migrate-playlist "My Awesome Playlist"
# Migrate all playlists (use with caution!)
poetry run spotify-to-ytmusic migrate-all --limit 5# View Spotify and YouTube Music account info
poetry run spotify-to-ytmusic info# List all Spotify playlists
poetry run spotify-to-ytmusic list-playlists
# List playlists with Spotify IDs (useful for duplicates)
poetry run spotify-to-ytmusic list-playlists --show-ids
# List saved albums (not yet implemented)
poetry run spotify-to-ytmusic list-albums# Migrate a specific playlist (private by default)
poetry run spotify-to-ytmusic migrate-playlist "Playlist Name"
# Migrate as public playlist
poetry run spotify-to-ytmusic migrate-playlist "Playlist Name" --public
# Migrate playlist by Spotify ID (useful for playlists with duplicate names)
poetry run spotify-to-ytmusic migrate-playlist --playlist-id 37i9dQZF1DXcBWIGoYBM5M
# Migrate all playlists (you'll be prompted to confirm)
# Note: Playlists with duplicate names will be skipped
poetry run spotify-to-ytmusic migrate-all
# Migrate limited number of playlists for testing
poetry run spotify-to-ytmusic migrate-all --limit 3- Authentication: Uses OAuth for Spotify and browser header authentication for YouTube Music
- Playlist Export: Fetches playlist metadata and all track details from Spotify
- Smart Matching: Searches for tracks on YouTube Music using:
- ISRC codes (International Standard Recording Code) for exact matches
- Track name and artist fuzzy matching as fallback
- Playlist Creation: Creates equivalent playlists on YouTube Music
- Track Addition: Adds matched tracks to the new playlists
- Reporting: Provides detailed success/failure reports
spotify-to-ytmusic/
├── src/
│ └── spotify_to_ytmusic/
│ ├── models/ # Data models (Track, Playlist, Album)
│ ├── services/ # API service wrappers
│ │ ├── spotify_service.py
│ │ └── ytmusic_service.py
│ └── cli.py # Command-line interface
├── .env.example # Environment template
├── pyproject.toml # Poetry dependencies
└── README.md
- Make sure you created a
.envfile (not.env.example) - Verify your Client ID and Secret are correct
- Check there are no extra spaces or quotes
- Run
poetry run spotify-to-ytmusic setup-ytmusicfirst - Follow the browser header authentication instructions completely
- Make sure you're logged into YouTube Music in your browser before copying headers
- Some tracks may not be available on YouTube Music
- Regional restrictions may apply
- Check the migration report for failed tracks
- If you have multiple playlists with the same name,
migrate-playlistwill show you all matches in a table - Use
--playlist-idto specify exactly which playlist to migrate - Run
list-playlists --show-idsto see all playlist IDs - When using
migrate-all, playlists with duplicate names are automatically skipped and listed in the summary
Current: CLI MVP (Minimum Viable Product)
Successfully migrates Spotify playlists to YouTube Music with smart matching.
- Album migration support
- Web application with UI for easier use
- Migration history and undo functionality
- Reverse migration (YouTube Music → Spotify)
- Batch operations and scheduling
- Better error handling and retry logic
- Export migration reports to CSV/JSON
This is currently a personal project. Feel free to fork and modify for your own use.
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) - see the LICENSE file for details.
Note: Built with assistance from Claude Code