fixed decrypting tracks with fallback

This commit is contained in:
uh wot 2021-08-01 20:35:56 +02:00
parent e96b2ade6d
commit 6994f35062
Signed by: uhwot
GPG Key ID: CB2454984587B781
2 changed files with 7 additions and 2 deletions

2
dist/worker.js vendored

File diff suppressed because one or more lines are too long

View File

@ -184,6 +184,11 @@ async function track(id, format, access_token, tagging) {
writer.write(id3.arrayBuffer) writer.write(id3.arrayBuffer)
} }
// needed if track has fallback, like https://www.deezer.com/track/11835714
if (json.alternative) {
id = json.alternative.id.toString()
}
const bfKey = await bf_key(id) const bfKey = await bf_key(id)
const length = Number(track.headers.get('Content-Length')) const length = Number(track.headers.get('Content-Length'))
@ -231,7 +236,7 @@ async function pipeDecryptedStream(writer, body, length, bfKey) {
} }
async function track_url(json, format) { async function track_url(json, format) {
// needed if track has fallback, like https://www.deezer.com/track/1398759152 // needed if track has fallback, like https://www.deezer.com/track/11835714
if (json.alternative) { if (json.alternative) {
json = json.alternative json = json.alternative
} }