Add Support For: tm0/2/3/6

remotes/origin/HEAD
MengYX 5 years ago
parent bddde78fcd
commit eec5bd0fb8
No known key found for this signature in database
GPG Key ID: E63F9C7303E8F604

@ -2,6 +2,7 @@ const NcmDecrypt = require("./ncm");
const QmcDecrypt = require("./qmc"); const QmcDecrypt = require("./qmc");
const RawDecrypt = require("./raw"); const RawDecrypt = require("./raw");
const MFlacDecrypt = require("./mflac"); const MFlacDecrypt = require("./mflac");
const TmDecrypt = require("./tm");
export {CommonDecrypt} export {CommonDecrypt}
@ -16,9 +17,11 @@ async function CommonDecrypt(file) {
case "mp3":// Raw Mp3 case "mp3":// Raw Mp3
case "flac"://Raw Flac case "flac"://Raw Flac
case "m4a":// todo: Raw M4A case "m4a":// todo: Raw M4A
rt_data = await RawDecrypt.Decrypt(file.raw, raw_filename, raw_ext);
break;
case "tm0":// QQ Music IOS Mp3 case "tm0":// QQ Music IOS Mp3
case "tm3":// QQ Music IOS Mp3 case "tm3":// QQ Music IOS Mp3
rt_data = await RawDecrypt.Decrypt(file.raw, raw_filename, raw_ext); rt_data = await RawDecrypt.Decrypt(file.raw, raw_filename, "mp3");
break; break;
case "qmc3"://QQ Music Android Mp3 case "qmc3"://QQ Music Android Mp3
case "qmc0"://QQ Music Android Mp3 case "qmc0"://QQ Music Android Mp3
@ -31,7 +34,7 @@ async function CommonDecrypt(file) {
break; break;
case "tm2":// todo: QQ Music IOS M4A case "tm2":// todo: QQ Music IOS M4A
case "tm6":// todo: QQ Music IOS M4A case "tm6":// todo: QQ Music IOS M4A
debugger; rt_data = await TmDecrypt.Decrypt(file.raw, raw_filename);
break; break;
default: default:
rt_data = {status: false, message: "不支持此文件格式",} rt_data = {status: false, message: "不支持此文件格式",}

@ -0,0 +1,14 @@
const rawDecrypt = require("./raw");
const util = require("./util");
export {Decrypt}
const header = [0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70];
async function Decrypt(file, raw_filename) {
const fileBuffer = await util.GetArrayBuffer(file);
const audioData = new Uint8Array(fileBuffer);
for (let cur = 0; cur < 8; ++cur) {
audioData[cur] = header[cur];
}
const musicData = new Blob([audioData], {type: "audio/mp4"});
return await rawDecrypt.Decrypt(musicData, raw_filename, "m4a")
}
Loading…
Cancel
Save