apilink / scripts /decrypt-anime.js
franyer24's picture
update logic
1ce7a42 verified
Raw
History Blame Contribute Delete
1.48 kB
const crypto = require('crypto');
const fs = require('fs');
const resp = JSON.parse(fs.readFileSync('E:\\laragon\\www\\project\\data\\anime-responses.json', 'utf8'));
const infoBody = resp[0].body;
const key = Buffer.from([107,105,101,109,116,105,101,110,109,117,97,57,49,49,99,97]);
const iv = Buffer.from([49,50,51,52,53,54,55,56,57,48,111,105,117,121,116,114]);
console.log('Body length:', infoBody.length);
console.log('Key length:', key.length, '| IV length:', iv.length);
const cipherBuf = Buffer.from(infoBody, 'hex');
console.log('Cipher buffer length:', cipherBuf.length);
const decipher = crypto.createDecipheriv('aes-128-cbc', key, iv);
let dec = decipher.update(cipherBuf);
dec = Buffer.concat([dec, decipher.final()]);
const json = dec.toString('utf8');
console.log('Decrypted length:', json.length);
const obj = JSON.parse(json);
console.log('\nKeys:', Object.keys(obj));
// Deep search for video URLs
const findUrls = (o, path = '') => {
for (const [k, v] of Object.entries(o || {})) {
const p = path ? `${path}.${k}` : k;
if (typeof v === 'string' && (v.includes('http') || v.includes('m3u8') || v.includes('.mp4') || v.includes('.ts'))) {
console.log(`${p}: ${v.substring(0, 300)}`);
} else if (typeof v === 'object' && v !== null) {
findUrls(v, p);
}
}
};
findUrls(obj);
fs.writeFileSync('E:\\laragon\\www\\project\\data\\anime-decrypted.json', JSON.stringify(obj, null, 2));
console.log('\nSaved to anime-decrypted.json');