$ show linsomniac/spotify_to_ytmusic
This is a Python application for migrating playlists and liked songs from Spotify to YouTube Music. It provides both a command-line interface (CLI) and a graphical user interface (GUI) built with Tkinter. The tool first backs up Spotify data (playlists, liked songs, liked albums) into a local JSON file using a modified version of the spotify-backup script. Then it reads that JSON and uses ytmusicapi to add or like songs on YouTube Music, employing a multi-algorithm search strategy to match tracks. The architecture is monolithic: a single package with CLI entry points defined in pyproject.toml and a GUI module. Key external dependencies are ytmusicapi, tkinter, and the Spotify Web API. The code is well-structured with clear separation of concerns (backend logic, CLI, GUI, backup) and includes retry logic for API rate limits. The search algorithm supports exact matching, extended matching, and fuzzy matching with video fallback, demonstrating thoughtful design for cross-platform music identification.
The LLM identified 2 files worth highlighting for reuse:
The `lookup_song` function implements a multi-strategy search algorithm to find a YouTube Music track given Spotify track metadata (name, artist, album). It first tries to match by looking up the album on YTMusic and finding the exact track name within the album's tracks. Failing that, it performs a general song search and applies one of three algorithms: 0 (return first result), 1 (exact match on title, artist, album), or 2 (fuzzy match with bracket removal and video fallback). This function is self-contained (only depends on ytmusicapi and re) and could be extracted into a standalone music matching utility for other projects that need to cross-reference tracks between music services.
This is a standalone script (forked from caseychu/spotify-backup) that authenticates with the Spotify API via OAuth, fetches the user's playlists, liked songs, and liked albums, and writes them to a JSON file. It handles pagination, retries, and local HTTP server for OAuth callback. The script is self-contained with no internal dependencies on the rest of the project. It can be reused independently to back up Spotify data for any purpose, not just for the YTMusic migration. The MIT license allows easy integration into other projects.