explaingit

linsomniac/spotify_to_ytmusic

4,551PythonAudience · generalComplexity · 2/5Setup · moderate

TLDR

A Python tool that copies your Spotify liked songs, albums, and playlists to YouTube Music, with both a graphical step-by-step interface and command-line scripts.

Mindmap

mindmap
  root((repo))
    What it does
      Copy liked songs
      Copy playlists
      Copy albums
    How to use
      Graphical interface
      Command line scripts
    Setup steps
      Python virtual env
      Browser credentials
      JSON backup
    Use cases
      Music migration
      Library backup
      Playlist sync
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Copy all your Spotify playlists to YouTube Music in a single command.

USE CASE 2

Transfer liked songs and albums from Spotify using a step-by-step graphical interface.

USE CASE 3

Migrate a specific Spotify playlist by ID, creating it on YouTube Music if it does not exist yet.

USE CASE 4

Back up your Spotify library as a local JSON file before starting the migration.

Tech stack

Pythonytmusicapi

Getting it running

Difficulty · moderate Time to first run · 30min

Authentication requires manually copying browser request headers from YouTube Music developer tools - there is no standard OAuth flow.

In plain English

This is a Python tool for copying your music library from Spotify to YouTube Music. It handles three things: your liked songs, your liked albums, and your playlists. You can use either a graphical interface or command-line scripts, depending on your preference. The setup process requires a few manual steps before anything can run. You need to install Python, clone the repository, and create a Python virtual environment (an isolated space for the tool's dependencies). Then you generate credentials for YouTube Music by copying request headers from your browser's developer tools while logged into YouTube Music, and pasting them into a file the tool reads. Once that file exists, the graphical interface picks it up automatically and skips the manual login step. The graphical interface walks you through the migration in tabs. The first step is backing up your Spotify data by saving your playlists and liked songs into a local JSON file. Subsequent tabs let you import liked songs to YouTube Music, list your playlists on both services, copy all playlists at once, or copy a specific playlist by its ID. The tool matches Spotify tracks to YouTube Music tracks by searching for the album and artist. The author reports good matching results across thousands of songs, with occasional issues on less common titles. The command-line version provides the same functionality through individual scripts. You can copy all playlists with one command, or target a specific playlist using its ID. A playlist that does not yet exist on YouTube Music can be created on the fly by prefixing its name with a plus sign in the command. Re-running any copy command is described as safe: it will not create duplicate entries. The tool is written in Python and depends on the ytmusicapi library.

Copy-paste prompts

Prompt 1
Walk me through setting up spotify_to_ytmusic: installing dependencies, copying YouTube Music browser headers for authentication, and running the graphical interface.
Prompt 2
I have my Spotify library backed up as JSON using spotify_to_ytmusic. Help me write a script to find which tracks failed to match on YouTube Music.
Prompt 3
Show me the spotify_to_ytmusic command to copy a specific Spotify playlist to YouTube Music and create a new playlist there if it does not already exist.
Prompt 4
Help me understand how ytmusicapi authentication works in spotify_to_ytmusic and what to do when my YouTube Music credentials expire.
Open on GitHub → Explain another repo

← linsomniac on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.