From e0c72296d3d27d79f3825870fd5b0ae28411ab78 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Wed, 28 Jul 2021 13:07:24 +0200 Subject: [PATCH] Fixed alternative checking --- deemix/downloader.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deemix/downloader.js b/deemix/downloader.js index 18df8c9..5d0344a 100644 --- a/deemix/downloader.js +++ b/deemix/downloader.js @@ -76,7 +76,7 @@ async function getPreferredBitrate(dz, track, preferredBitrate, shouldFallback, if (track.localTrack) { return TrackFormats.LOCAL} let falledBack = false - let hasAlternative = track.fallbackID !== "0" + let hasAlternative = track.fallbackID != 0 let isGeolocked = false let wrongLicense = false @@ -157,17 +157,17 @@ async function getPreferredBitrate(dz, track, preferredBitrate, shouldFallback, // Current bitrate is higher than preferred bitrate; skip if (formatNumber > preferredBitrate) { continue } - let url let currentTrack = track + let url = await getCorrectURL(currentTrack, formatName, formatNumber) let newTrack do { - url = await getCorrectURL(currentTrack, formatName, formatNumber) - if (hasAlternative && !url){ + if (!url && hasAlternative){ newTrack = await dz.gw.get_track_with_fallback(currentTrack.fallbackID) currentTrack = new Track() currentTrack.parseEssentialData(newTrack) - hasAlternative = currentTrack.fallbackID !== "0" + hasAlternative = currentTrack.fallbackID != 0 } + url = await getCorrectURL(currentTrack, formatName, formatNumber) } while (!url && hasAlternative) if (url) {