A .NET console app that reads tracks from a Spotify playlist, searches for the matching songs on YouTube, creates a YouTube playlist, and adds the matched videos to it.
- Reads playlist tracks from Spotify
- Searches YouTube for each song and artist
- Creates a new YouTube playlist
- Adds the first matching YouTube result for each track
- Uses environment variables for API credentials
- .NET 6 SDK
- Spotify Developer application credentials
- Google Cloud project with the YouTube Data API enabled
- OAuth client secret JSON file for YouTube access
Clone the repository:
git clone https://github.com/benbop/SpotifyPlaylist-alpha.git
cd SpotifyPlaylist-alphaSet the required environment variables:
export SPOTIFY_CLIENT_ID="your_spotify_client_id"
export SPOTIFY_CLIENT_SECRET="your_spotify_client_secret"
export YOUTUBE_CLIENT_SECRET_PATH="/path/to/client_secret.json"On Windows PowerShell:
$env:SPOTIFY_CLIENT_ID="your_spotify_client_id"
$env:SPOTIFY_CLIENT_SECRET="your_spotify_client_secret"
$env:YOUTUBE_CLIENT_SECRET_PATH="C:\path\to\client_secret.json"Before running, update SpotifyApiCalls.cs and replace YOUR_PLAYLIST_ID with
the Spotify playlist ID you want to copy. You can also change the generated
YouTube playlist title in YoutubeApiCalls.cs.
dotnet run --project SpotifyPlaylist-alphaThe first run opens the Google OAuth flow so the app can create and update a playlist on your YouTube account.
Program.cs- application entry pointSpotifyApiCalls.cs- Spotify authentication and playlist track loadingYoutubeApiCalls.cs- YouTube OAuth, playlist creation, search, and inserts
MIT