Noureddine RAMDI / Spotify2YoutubeMusic: a Python tool for migrating music libraries between Spotify and YouTube Music

Created Sat, 23 May 2026 20:41:14 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

mahdi-y/Spotify2YoutubeMusic

Migrating your music library between streaming platforms is something many users want but few tools handle smoothly. Spotify2YoutubeMusic tackles this common pain point by automating transfers between Spotify and YouTube Music with a polished Python desktop app that offers both a graphical interface and command-line control.

What Spotify2YoutubeMusic does and how it works

At its core, Spotify2YoutubeMusic is a desktop application written in Python that migrates music libraries between Spotify and YouTube Music. It supports playlist transfers, importing liked songs, and following artists. The user interface is built with tkinter, providing a dark-themed GUI that feels straightforward for end-users, while a CLI mode offers scriptable automation.

Under the hood, the app wraps two popular API wrappers: spotipy for Spotify and ytmusicapi for YouTube Music. These libraries handle OAuth and API interactions, so the main app focuses on orchestrating the migration flow rather than API details.

A key architectural component is the search caching system. When looking up songs on YouTube Music, the app caches the results in a JSON file (song_cache.json). This cache prevents redundant searches on re-runs or overlapping playlist transfers, which turns what would be an O(n) search problem into O(1) lookups for cached tracks. This design dramatically speeds up subsequent migrations.

The migration process also features adjustable batch processing with batch sizes between 1 and 20 tracks. This batching allows the app to balance between speed and API rate limits, with presets for quick or cautious processing. If a batch fails or authentication headers expire, the app automatically resumes from the last successful batch, saving progress at the batch level.

The architecture thus divides responsibilities into a UI layer that calls API wrappers, which themselves are managed by middleware handling caching, batching, and resume logic. This separation keeps the code maintainable and focused.

Technical strengths and design tradeoffs

One of the standout features is the smart search caching layer. By persisting found YouTube Music tracks in a local JSON cache, the app avoids repeating expensive lookups for known songs. This cache is a practical optimization that improves the user experience, especially for users managing multiple playlists or frequently running the migration.

The use of spotipy and ytmusicapi means the app relies on well-maintained third-party libraries for API access, reducing the maintenance burden of handling OAuth flows and API quirks directly. However, this also means the app’s behavior depends on the stability and limitations of these libraries and the underlying APIs.

Batch processing with adjustable sizes is a thoughtful design to handle API rate limits and network reliability issues. Saving progress at the batch level and automatically resuming after failures or expired tokens makes the tool robust in real-world usage, where network hiccups or auth token expiry are common.

The use of tkinter for the GUI keeps dependencies minimal since tkinter is bundled with Python, but it also limits the UI design flexibility compared to modern frameworks. The CLI mode compensates for this by enabling automation and scripting.

One tradeoff is that the app requires user-provided Spotify API credentials and YouTube Music browser headers for authentication, which adds setup complexity. The caching mechanism also means users need to be mindful of cache validity if playlists change externally.

Quick start

The project provides streamlined setup scripts for all major platforms, making it easy to install and run without manual dependency management. Here are the commands exactly as provided:

Windows (PowerShell):

iwr -useb https://raw.githubusercontent.com/mahdi-y/Spotify2YoutubeMusic/master/S2YM.bat -OutFile S2YM.bat; ./S2YM.bat

macOS/Linux:

curl -O https://raw.githubusercontent.com/mahdi-y/Spotify2YoutubeMusic/master/S2YM.sh && bash S2YM.sh

These scripts check for Python 3.8 or newer and Git, clone or update the repo, create a virtual environment, install dependencies, and launch the app. The ASCII progress messages provide visual feedback, making it accessible even for less experienced users.

For manual installation, the README also documents cloning the repository and setting up a virtual environment manually, but the setup scripts are the recommended path.

Verdict

Spotify2YoutubeMusic is a pragmatic tool for anyone wanting to move their music collections between Spotify and YouTube Music. It solves a real problem with a clean architecture and practical optimizations like caching and batch resuming.

The reliance on spotipy and ytmusicapi means it benefits from stable API wrappers, but the need for Spotify credentials and YouTube Music headers means it’s more suited for users comfortable with some configuration steps.

Its cross-platform support and dual GUI/CLI modes make it versatile for both casual users and power users wanting automation. The caching mechanism is particularly useful for repeated or incremental transfers, saving time and API calls.

The tradeoffs around UI flexibility and setup complexity are reasonable for a project of this scope and tech stack. Overall, it’s an honest, well-structured tool that addresses a specific but common migration challenge for music enthusiasts.


→ GitHub Repo: mahdi-y/Spotify2YoutubeMusic ⭐ 360 · Python