mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-21 18:55:36 +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:
parent
33e51bbaef
commit
917b4371a6
1 changed files with 8 additions and 5 deletions
|
|
@ -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<String> = 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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue