This application allows users to transfer their Spotify playlists to YouTube Music. It authenticates with both services, reads playlist data from Spotify, and recreates those playlists in YouTube Music with matching songs.
- OAuth authentication with Spotify
- YouTube Music authentication
- Playlist data extraction from Spotify API
- Intelligent song matching between platforms
- Batch processing with rate limiting
- Local SQLite database for tracking transfer progress
- Support for transferring single playlists or bulk transfers
- Web-based authentication flow
- Python 3.7+
- Flask
- ytmusicapi
- httpx
- dotenv
- Clone the repository
- Install the requirements:
pip install -r requirements.txt
- Create a
.env
file with your Spotify API credentials:client_id=your_spotify_client_id client_secret=your_spotify_client_secret
Run the main script to start the transfer process:
python main.py
This will:
- Authenticate with Spotify (if needed)
- Load your playlists
- Allow you to select which playlists to transfer
- Authenticate with YouTube Music
- Create matching playlists in YouTube Music
- Search for and add songs to the new playlists
You can customize the transfer process by modifying the main()
function in main.py
. The application supports:
- Transferring specific playlists by URL
- Resuming transfers
- Using an existing database
- Authentication: The app authenticates with Spotify using OAuth and with YouTube Music using browser cookies.
- Data Extraction: Playlist and song data is extracted from Spotify and stored in a local SQLite database.
- Song Matching: For each Spotify song, the app searches YouTube Music for the best match.
- Playlist Creation: New playlists are created in YouTube Music with matching metadata.
- Song Addition: Matched songs are added to the new playlists in batches to avoid rate limiting.
main.py
- Main application entry pointspotify_auth.py
- Spotify authentication serverspotify.py
- Spotify API clientyoutube.py
- YouTube Music API clientdatabase.py
- SQLite database managertemplates/
- HTML templates for authentication flow
- YouTube auto auth - Implement automatic authentication for YouTube Music without manual cookie capture
- Main function - Improve the main script interface with better command-line options and user interaction
- Add proper error handling for network failures
- Implement playlist synchronization (keeping playlists updated)
- Add support for transferring liked songs
- Create a proper GUI
- Add support for Apple Music
- Implement better similarity matching for finding songs
- Spotify Authentication Fails: Ensure your client ID and secret are correct in the
.env
file - YouTube Music Authentication Fails: You may need to manually capture cookies using the browser
- Rate Limiting: If you hit API rate limits, try increasing the delay between requests
- Song Matching Issues: Some songs may not find perfect matches - check the logs for details
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.