diff --git a/package.json b/package.json index cffe529..9085a60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unblock-netease-music", - "version": "0.2.2", + "version": "0.2.5", "scripts": { "start": "node ./bin/www" }, diff --git a/routes/index.js b/routes/index.js index a11b4a1..3e61d36 100644 --- a/routes/index.js +++ b/routes/index.js @@ -83,17 +83,17 @@ router.post('/eapi/song/enhance/player/url', function(req, res, next) { if (err) { console.error(err); } else { - callback(null, url, bitrate, filesize); + callback(null, url, hash, bitrate, filesize); } }); } - ], function(err, url, bitrate, filesize) { + ], function(err, url, hash, bitrate, filesize) { if(err) { console.error(err); res.status = 500; res.send(); }else{ - res.defaultBody = utils.netease.modifyPlayerApiCustom(url, bitrate, filesize, res.defaultBody); + res.defaultBody = utils.netease.modifyPlayerApiCustom(url, hash, bitrate, filesize, res.defaultBody); next(); } }); @@ -135,17 +135,17 @@ router.post('/eapi/song/enhance/download/url', function(req, res, next) { if (err) { console.error(err); } else { - callback(null, url, bitrate, filesize); + callback(null, url, hash, bitrate, filesize); } }); } - ], function(err, url, bitrate, filesize) { + ], function(err, url, hash, bitrate, filesize) { if(err) { console.error(err); res.status = 500; res.send(); }else{ - res.defaultBody = utils.netease.modifyDownloadApiCustom(url, bitrate, filesize, res.defaultBody); + res.defaultBody = utils.netease.modifyDownloadApiCustom(url, hash, bitrate, filesize, res.defaultBody); next(); } }); diff --git a/utils/netease/index.js b/utils/netease/index.js index 69cd08c..8ffa58e 100644 --- a/utils/netease/index.js +++ b/utils/netease/index.js @@ -97,7 +97,7 @@ netease.prototype.modifyDetailApi = function(body) { .replace(/\"subp\":\d+/g, '"subp":1'); } -netease.prototype.modifyPlayerApiCustom = function(newUrl, bitrate, filesize, body) { +netease.prototype.modifyPlayerApiCustom = function(newUrl, hash, bitrate, filesize, body) { console.log("Player API Injected".green); var _this = this; @@ -109,14 +109,14 @@ netease.prototype.modifyPlayerApiCustom = function(newUrl, bitrate, filesize, bo body["data"][0]["url"] = newUrl; body["data"][0]["br"] = bitrate; body["data"][0]["code"] = "200"; - // body["data"][0]["md5"] = 'efba483eb717cc872436075748bcfcf8'; body["data"][0]["size"] = filesize; + body["data"][0]["md5"] = hash; body["data"][0]["type"] = "mp3"; return JSON.stringify(body); } -netease.prototype.modifyDownloadApiCustom = function(newUrl, bitrate, body) { +netease.prototype.modifyDownloadApiCustom = function(newUrl, hash, bitrate, filesize, body) { console.log("Download API Injected".green); var _this = this; @@ -128,6 +128,9 @@ netease.prototype.modifyDownloadApiCustom = function(newUrl, bitrate, body) { body["data"]["url"] = newUrl; body["data"]["br"] = bitrate; body["data"]["code"] = "200"; + body["data"]["size"] = filesize; + body["data"]["md5"] = hash; + body["data"]["type"] = "mp3"; return JSON.stringify(body); }