1
0
forked from um/web

#20 Add Support For Netease DJ Files

This commit is contained in:
MengYX 2020-02-29 19:52:41 +08:00
parent 98ca5bc8ff
commit 1d83898f08
No known key found for this signature in database
GPG Key ID: E63F9C7303E8F604

View File

@ -32,7 +32,7 @@ export async function Decrypt(file) {
const artists = []; const artists = [];
musicMeta.artist.forEach(arr => artists.push(arr[0])); musicMeta.artist.forEach(arr => artists.push(arr[0]));
if (musicMeta.format === "mp3") if (musicMeta.format === "mp3")
audioData = await writeID3(audioData, artists, musicMeta.musicName, musicMeta.album, musicMeta.albumPic) audioData = await writeID3(audioData, artists, musicMeta.musicName, musicMeta.album, musicMeta.albumPic);
const musicData = new Blob([audioData], {type: mime}); const musicData = new Blob([audioData], {type: mime});
return { return {
@ -145,9 +145,12 @@ function getMetaData(dataView, fileBuffer, offset) {
}, },
META_KEY, META_KEY,
{mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7} {mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7}
); ).toString(CryptoJS.enc.Utf8);
const labelIndex = plainText.indexOf(":");
const result = JSON.parse(plainText.toString(CryptoJS.enc.Utf8).slice(6)); let result = JSON.parse(plainText.slice(labelIndex + 1));
if (plainText.slice(0, labelIndex) === "dj") {
result = result.mainMusic;
}
result.albumPic = result.albumPic.replace("http:", "https:"); result.albumPic = result.albumPic.replace("http:", "https:");
return {data: result, offset: offset}; return {data: result, offset: offset};
} }