mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-07 11:02:08 +08:00
optimize base cookie for multiple users
This commit is contained in:
14
util/init.js
14
util/init.js
@ -2,7 +2,15 @@ function randomString(pattern, length){
|
||||
return Array.apply(null, {length: length}).map(() => (pattern[Math.floor(Math.random() * pattern.length)])).join('');
|
||||
}
|
||||
|
||||
const jsessionid = randomString('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ\\/+',176) + ':' + (new Date).getTime();
|
||||
const nuid = randomString('0123456789abcdefghijklmnopqrstuvwxyz',32);
|
||||
function generateCookie(){
|
||||
const jsessionid = randomString('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKMNOPQRSTUVWXYZ\\/+',176) + ':' + (new Date).getTime();
|
||||
const nuid = randomString('0123456789abcdefghijklmnopqrstuvwxyz',32);
|
||||
return {
|
||||
'JSESSIONID-WYYY': jsessionid,
|
||||
'_iuqxldmzr_': 32,
|
||||
'_ntes_nnid': nuid + ',' + (new Date).getTime(),
|
||||
'_ntes_nuid': nuid
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = `JSESSIONID-WYYY=${jsessionid}; _iuqxldmzr_=32; _ntes_nnid=${nuid},${(new Date).getTime()}; _ntes_nuid=${nuid}`;
|
||||
module.exports = generateCookie
|
Reference in New Issue
Block a user