Want to export playlists from Spotify to Youtube? I gotchu. :)
SpoYT is a Python application that transfers playlists from Spotify to YouTube. This tool allows you to migrate your favorite playlists across platforms with ease.
- Python 3.11 or later
google-auth-oauthlibgoogle-api-python-clientspotipypython-dotenv
You can install the required Python libraries using pip:
pip install google-auth-oauthlib google-api-python-client spotipy python-dotenv-
Create a Google Cloud Project:
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
-
Enable the YouTube Data API v3:
- Navigate to the “APIs & Services” > “Library” and search for "YouTube Data API v3".
- Enable the API for your project.
-
Create OAuth 2.0 Credentials:
- Go to “APIs & Services” > “Credentials”.
- Click on “Create Credentials” and choose “OAuth 2.0 Client ID”.
- Select “Desktop app” (or “Web application” if applicable) and configure the redirect URIs if necessary.
- Download the
credentials.jsonfile.
-
Create a Spotify Developer Account:
- Go to the Spotify Developer Dashboard.
- Log in or sign up, then create a new application.
-
Get Credentials:
- Note your
Client IDandClient Secret. - Set the redirect URI (e.g.,
http://localhost:8888/callback).
- Note your
- Create a
.envFile:-
In the root directory of your project, create a
.envfile. -
Add the following lines with your own credentials:
SPOTIPY_CLIENT_ID=your_spotify_client_id SPOTIPY_CLIENT_SECRET=your_spotify_client_secret SPOTIPY_REDIRECT_URI=http://localhost:8888/callback YOUTUBE_CLIENT_SECRET_FILE=path_to_your_credentials.json
-
-
Authenticate with Spotify and YouTube:
- Ensure that you have set up OAuth 2.0 credentials as described in the setup sections.
-
Execute the Script:
-
Run the Python script to start transferring your playlist:
python main.py
-
-
Find your Spotify Playlist Id:
- Add it to the
spotify_playlist_idvariable in main.py.
- Add it to the
-
Decide New Playlist Name:
-
- Add it to the
youtube_playlist_titlevariable in main.py.
- Add it to the
-
Here is an example of how to use the provided script to add a video to a YouTube playlist:
if __name__ == "__main__":
spotify_playlist_id = '37i9dQZF1DX9tPFwDMOaN1'
youtube_playlist_title = 'KPOP ON'
transfer_playlist(spotify_playlist_id, youtube_playlist_title)- Service Unavailable: If you encounter
SERVICE_UNAVAILABLEerrors, check the Google API status and retry after some time. - Invalid Credentials: Ensure your
credentials.jsonand.envfile are correctly configured. - Quota Limits: Verify you have not exceeded API quota limits.
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0). See the LICENSE file for details.