$ show spotDL/spotify-downloader
spotDL is a production-grade Python CLI that turns Spotify URLs, playlist links, or plain song searches into locally downloaded audio files with embedded metadata. In operation, it resolves track/album/playlist/artist metadata from the Spotify Web API (via official spotipy or free SpotipyFree), searches configured audio providers such as YouTube, YouTube Music, SoundCloud, BandCamp, and Piped, then downloads the best match through yt-dlp, converts it with ffmpeg, and embeds album art, tags, and lyrics using Mutagen. Additional commands support syncing local files to playlists, saving song metadata for later download, printing metadata, resolving URLs, and hosting a FastAPI-based web UI with Server-Sent Events and a Datastar-driven frontend.
The LLM identified 6 files worth highlighting for reuse:
Ranks provider search results against Spotify track metadata using slugs, RapidFuzz ratio scoring, exact ISRC matches, and multiple heuristic fixups for artist/title noise. The algorithm is self-contained in its logic and can be extracted and reused for any song-to-result matching problem.
Writes track metadata, cover art, and lyrics into MP3, M4A, FLAC, OGG, OPUS, and WAV files in a format-agnostic way. Isolated from download/network concerns, making it directly reusable in other music library or audio processing pipelines.
Defines the AudioProvider interface and shared search/result-ordering behavior used by YouTube, YouTube Music, SoundCloud, BandCamp, and Piped providers. Demonstrates a clean strategy pattern for swapping and chaining external content sources.
Tracks already-processed URLs and skip-file entries so bulk downloads can be resumed without re-downloading completed tracks. The archive pattern is portable to any job/pipeline needing idempotency and resumability.
Walks the GitHub Contents API tree and downloads all files from a remote repository directory, used for fetching the bundled web UI. It is a self-contained utility for retrieving versioned external assets at runtime or build time.
Builds a dynamic settings model that merges CLI arguments, JSON config file values, and defaults, including backward-compatible migration for legacy config paths. This is a reusable pattern for CLI tools that need persistent, overridable, validated configuration.