A simple Python script to transfer your Spotify playlists to YouTube Music.
This tool allows you to easily transfer your Spotify playlists to YouTube Music. It fetches all tracks from a Spotify playlist and creates a new playlist with the same tracks on YouTube Music.
- Transfer complete Spotify playlists to YouTube Music
- Handles large playlists with pagination
- Preserves playlist name and description
- Simple command-line interface
- Python 3.6 or higher
- Spotify Developer account and API credentials
- YouTube Music/Google OAuth credentials
-
Clone the repository:
git clone https://github.com/yourusername/spotify-to-ytmusic.git cd spotify-to-ytmusic
-
Install required packages:
pip install -r requirements.txt
-
Set up environment variables:
- Copy
.env.example
to.env
- Fill in your API credentials:
S_ID
: Spotify Client IDS_SECRET
: Spotify Client SecretY_ID
: YouTube/Google Client IDY_SECRET
: YouTube/Google Client Secret
- Copy
- Go to the Spotify Developer Dashboard
- Create a new application
- Note your Client ID and Client Secret
- Add these to your
.env
file
- Set up a project in the Google Cloud Console
- Create OAuth credentials (TV client type)
- Download the credentials and use them with the ytmusicapi setup
- Set up OAuth:
This will create the
python -m ytmusicapi oauth
oauth.json
file needed for authentication.
-
Run the script:
python main.py
-
When prompted, enter the Spotify playlist link. Example:
https://open.spotify.com/playlist/37i9dQZEVXcJZyENOWUFo7
-
The script will:
- Fetch all tracks from the Spotify playlist
- Create a new playlist on YouTube Music with the same name and description
- Search for each track on YouTube Music and add it to the new playlist
- Display progress and results in the terminal