1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-07-22 03:05:32 +02:00

feat(core): attempt SpotifyTrack via yt-dlp instead of hard-failing

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.
This commit is contained in:
TheGeneralist 2026-07-21 17:45:20 +02:00
parent 33e51bbaef
commit 917b4371a6
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4

View file

@ -1051,14 +1051,16 @@ pub fn perform_capture(
)); ));
} }
// Sources: Spotify — not downloadable; Spotify audio is DRM-protected. // Sources: Spotify — SpotifyTrack attempts yt-dlp and fails gracefully if the
if matches!(source, Source::SpotifyTrack | Source::SpotifyAlbum | Source::SpotifyPlaylist) { // 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( return Err(fail_run(
&conn, &conn,
&run, &run,
&item, &item,
"Spotify downloads are not supported: Spotify audio is DRM-protected and cannot \ "Spotify album/playlist capture is not yet implemented. \
be downloaded by yt-dlp. Archive the equivalent YouTube Music track instead.", Archive individual tracks instead.",
)); ));
} }
@ -1615,6 +1617,7 @@ pub fn perform_capture(
let ytdlp_metadata_json: Option<String> = match source { let ytdlp_metadata_json: Option<String> = match source {
Source::YouTubeVideo Source::YouTubeVideo
| Source::YouTubeMusicTrack | Source::YouTubeMusicTrack
| Source::SpotifyTrack
| Source::X | Source::X
| Source::Instagram | Source::Instagram
| Source::Facebook | 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. // Music tracks are always audio-only regardless of the caller's quality hint.
match downloader::ytdlp::download(path.clone(), store_path, &timestamp, Some("audio"), &cookies) { match downloader::ytdlp::download(path.clone(), store_path, &timestamp, Some("audio"), &cookies) {
Ok(result) => result, Ok(result) => result,