From 09857b1247c5ebace552e6f8a4ad46fc2129bbdf Mon Sep 17 00:00:00 2001 From: RemixDev Date: Thu, 23 Sep 2021 14:16:32 +0200 Subject: [PATCH] Fixed BAD STARTING SYNC issue when downloading some MP3s --- deemix/decryption.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deemix/decryption.py b/deemix/decryption.py index f40a164..ba0ea8b 100644 --- a/deemix/decryption.py +++ b/deemix/decryption.py @@ -80,10 +80,17 @@ def streamTrack(outputStream, track, start=0, downloadObject=None, listener=None 'value': complete }) + isStart = True for chunk in request.iter_content(2048 * 3): if isCryptedStream: if len(chunk) >= 2048: chunk = decryptChunk(blowfish_key, chunk[0:2048]) + chunk[2048:] + + if isStart and chunk[0] == 0: + for i, byte in enumerate(chunk): + if byte != 0: break + chunk = chunk[i:] + isStart = False outputStream.write(chunk) chunkLength += len(chunk)