From 917b4371a68b25e66573d664d2aa7317fd6fc211 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Tue, 21 Jul 2026 17:45:20 +0200 Subject: [PATCH] feat(core): attempt SpotifyTrack via yt-dlp instead of hard-failing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously all Spotify sources returned an error claiming yt-dlp cannot download DRM-protected audio. yt-dlp does have a Spotify extractor (experimental, content-dependent), so refusing upfront is worse than trying and letting it report the real failure. SpotifyTrack now goes through the same yt-dlp metadata + audio-quality download path as YouTubeMusicTrack. SpotifyAlbum and SpotifyPlaylist still return an explicit error — fetch_playlist_info has YouTube-specific URL fallback logic that would produce bogus child URLs for Spotify flat entries; those sources need dedicated container handling first. --- crates/archivr-core/src/capture.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/archivr-core/src/capture.rs b/crates/archivr-core/src/capture.rs index 0e2b526..5b43482 100644 --- a/crates/archivr-core/src/capture.rs +++ b/crates/archivr-core/src/capture.rs @@ -1051,14 +1051,16 @@ pub fn perform_capture( )); } - // Sources: Spotify — not downloadable; Spotify audio is DRM-protected. - if matches!(source, Source::SpotifyTrack | Source::SpotifyAlbum | Source::SpotifyPlaylist) { + // Sources: Spotify — SpotifyTrack attempts yt-dlp and fails gracefully if the + // extractor cannot handle the content. Albums and playlists are not yet supported + // as containers (fetch_playlist_info has YouTube-specific URL fallback logic). + if matches!(source, Source::SpotifyAlbum | Source::SpotifyPlaylist) { return Err(fail_run( &conn, &run, &item, - "Spotify downloads are not supported: Spotify audio is DRM-protected and cannot \ - be downloaded by yt-dlp. Archive the equivalent YouTube Music track instead.", + "Spotify album/playlist capture is not yet implemented. \ + Archive individual tracks instead.", )); } @@ -1615,6 +1617,7 @@ pub fn perform_capture( let ytdlp_metadata_json: Option = match source { Source::YouTubeVideo | Source::YouTubeMusicTrack + | Source::SpotifyTrack | Source::X | Source::Instagram | Source::Facebook @@ -1655,7 +1658,7 @@ pub fn perform_capture( } } } - Source::YouTubeMusicTrack => { + Source::YouTubeMusicTrack | Source::SpotifyTrack => { // Music tracks are always audio-only regardless of the caller's quality hint. match downloader::ytdlp::download(path.clone(), store_path, ×tamp, Some("audio"), &cookies) { Ok(result) => result,