Skip to content
NEWError doctor and Watchtower: failed n8n runs explained in plain words, and emailed to you. See what is new

Library / Data Sync & ETL

Data Sync & ETL

Sync Spotify Playlists to YouTube with Supabase

On a schedule, it detects changes in a Spotify playlist, finds the songs on YouTube, updates a YouTube playlist and logs to Supabase and Discord.

What it does

# Spotify to YouTube Playlist Synchronization ## A workflow that maintains a YouTube playlist in sync with a Spotify playlist, featuring smart video matching and persistent synchronization. ## Key Features - One-way Sync: Spotify playlist → YouTube playlist (additions and deletions - Continuous Monitoring: Automatic synchronization (every hour by default, but you can put any time you want) - Smart Video Matching: Considers video length and content relevance - Auto-Recovery: Automatically handles deleted YouTube videos - Database Backup: Persistent storage using Supabase ## Prerequisites 1. Supabase project with the following table structure: sql CREATE TABLE IF NOT EXISTS musics ( id TEXT PRIMARY KEY, title TEXT NOT NULL, artist TEXT NOT NULL, duration INT8 NOT NULL, youtube_video_id TEXT, to_delete BOOLEAN DEFAULT FALSE ); 2. Empty YouTube playlist (recommended as duplicates are not handled) 3. Configured credentials for YouTube, Spotify, and Supabase APIs 4. Properly set variables in all "variables" nodes (variables, variables1, variables2, variables3, variables4 (all the same)) 5. Activate the workflow ! ## Workflow Components ### Workflow 1: Main Sync Process 1. Change Detection - Monitors Spotify playlist for changes - Compares database state with current playlist 2. Video Matching - Searches YouTube based on title, artist, and duration - Evaluates top 5 results for best match - Marks unmatched tracks with "NOTFOUND" - Notifies user of successful matches and failures ### Workflow 2: YouTube Maintenance - Monitors YouTube playlist for removed videos - Flags removed videos for re-search - Handles deletion of marked videos ### Workflow 3: Recovery Process - Clears "NOTFOUND" flags periodically to re-search previously unmatched tracks ## Implementation Notes - Workflows can be separated into different files for better monitoring - Recovery process ensures long-term playlist maintenance

The steps

  1. Get playlist snapshot
  2. Get playlist snapshot1
  3. If different snapshot
  4. Get all musics
  5. Update to_delete to true
  6. Add music
  7. Compare Datasets
  8. Spotify
  9. No Operation, do nothing
  10. Get all musics not in youtube playlist
  11. Every day at noon
  12. Every day at noon + 1mn
  13. Every hour
  14. Wait 1 hour

48 steps in total.

Similar automations