Skip to content
This repository was archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
fix mobile download failed
Browse files Browse the repository at this point in the history
update version

fix mobile download

fix mobile download

update version
  • Loading branch information
ITJesse committed Apr 3, 2016
1 parent 2146179 commit b19d987
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unblock-netease-music",
"version": "0.2.2",
"version": "0.2.5",
"scripts": {
"start": "node ./bin/www"
},
Expand Down
12 changes: 6 additions & 6 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
Expand Down Expand Up @@ -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();
}
});
Expand Down
9 changes: 6 additions & 3 deletions utils/netease/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit b19d987

Please sign in to comment.