Skip to content

Commit

Permalink
[informal] solve -460 cheating
Browse files Browse the repository at this point in the history
  • Loading branch information
nondanee committed Aug 8, 2018
1 parent 9a42fc1 commit 1e8ed2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions util/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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);

module.exports = `JSESSIONID-WYYY=${jsessionid}; _iuqxldmzr_=32; _ntes_nnid=${nuid},${(new Date).getTime()}; _ntes_nuid=${nuid}`;
3 changes: 2 additions & 1 deletion util/util.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const Encrypt = require("./crypto.js");
const request = require("request");
const querystring = require("querystring");
const baseCookie = require("./init.js");

request.debug = true;

Expand Down Expand Up @@ -56,7 +57,7 @@ function createWebAPIRequest(
"Content-Type": "application/x-www-form-urlencoded",
Referer: "http://music.163.com",
Host: "music.163.com",
Cookie: cookie,
Cookie: baseCookie + (cookie ? "; " : "") + cookie,
"User-Agent": randomUserAgent()
},
body: querystring.stringify({
Expand Down

0 comments on commit 1e8ed2d

Please sign in to comment.