fix(download): pass Spotify durationMs through to yt-dlp duration filter

- downloads.js: use durationMs (Spotify) before trackTimeMillis (iTunes)
- server: read durationMs from top-level body, not only from tracks[0]
- server: also grab durationMs + trackNum from iTunes in the Spotify path

Without durationMs the duration filter never ran, allowing a 58s fan video
to pass all text filters and be downloaded instead of the actual song.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-06-19 09:55:17 +02:00
1 parent 5f257bf451
commit 86d3999628
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -567,7 +567,7 @@ app.post('/api/download', async (req, res) => {
discTotal: sp.discCount || bodyDiscTotal || undefined,
genre: sp.primaryGenreName || sp.genre || undefined,
artworkUrl: spArt, explicit: sp.trackExplicitness === 'explicit' || !!explicit,
durationMs: sp.durationMs || undefined,
durationMs: sp.durationMs || req.body.durationMs || undefined,
};
const searchArtist = artist.split(',')[0].trim();
if (!meta.album) {
@@ -584,6 +584,8 @@ app.post('/api/download', async (req, res) => {
if (!meta.totalTracks && genreMeta.totalTracks) { meta.totalTracks = genreMeta.totalTracks; }
if (!meta.discNum && genreMeta.discNum) { meta.discNum = genreMeta.discNum; }
if (!meta.discTotal && genreMeta.discTotal) { meta.discTotal = genreMeta.discTotal; }
if (!meta.durationMs && genreMeta.durationMs) { meta.durationMs = genreMeta.durationMs; }
if (!meta.trackNum && genreMeta.trackNum) { meta.trackNum = genreMeta.trackNum; }
}
}
const finalArtist = meta.itunesArtistName || artist;