unblock-netease-music
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -40,19 +40,12 @@ 'use strict'; | ||
res = ctx.response; | ||
songId = void 0, urlInfo = void 0; | ||
songId = void 0, urlInfo = void 0, data = void 0; | ||
_context.prev = 3; | ||
if (!/^\/eapi\/song\/enhance\/player\/url/.test(req.url)) { | ||
_context.next = 60; | ||
break; | ||
} | ||
data = ''; | ||
_context.prev = 5; | ||
data = JSON.parse(ctx.defaultBody.toString()); | ||
_context.next = 13; | ||
_context.next = 11; | ||
break; | ||
case 9: | ||
_context.prev = 9; | ||
_context.t0 = _context['catch'](5); | ||
case 7: | ||
_context.prev = 7; | ||
_context.t0 = _context['catch'](3); | ||
@@ -62,3 +55,8 @@ console.error("Parse JSON failed, return with no modify.".yellow); | ||
case 13: | ||
case 11: | ||
if (!/^\/eapi\/song\/enhance\/player\/url/.test(req.url)) { | ||
_context.next = 59; | ||
break; | ||
} | ||
newData = []; | ||
@@ -68,8 +66,8 @@ _iteratorNormalCompletion = true; | ||
_iteratorError = undefined; | ||
_context.prev = 17; | ||
_context.prev = 16; | ||
_iterator = (0, _getIterator3.default)(data["data"]); | ||
case 19: | ||
case 18: | ||
if (_iteratorNormalCompletion = (_step = _iterator.next()).done) { | ||
_context.next = 41; | ||
_context.next = 40; | ||
break; | ||
@@ -84,21 +82,21 @@ } | ||
if (!(playbackReturnCode != 200)) { | ||
_context.next = 36; | ||
_context.next = 35; | ||
break; | ||
} | ||
_context.prev = 24; | ||
_context.next = 27; | ||
_context.prev = 23; | ||
_context.next = 26; | ||
return _regenerator2.default.awrap(utils.getUrlInfo(songId)); | ||
case 27: | ||
case 26: | ||
urlInfo = _context.sent; | ||
_context.next = 33; | ||
_context.next = 32; | ||
break; | ||
case 30: | ||
_context.prev = 30; | ||
_context.t1 = _context['catch'](24); | ||
case 29: | ||
_context.prev = 29; | ||
_context.t1 = _context['catch'](23); | ||
return _context.abrupt('return', console.log(_context.t1)); | ||
case 33: | ||
case 32: | ||
if (urlInfo) { | ||
@@ -109,29 +107,29 @@ row = utils.netease.modifyPlayerApiCustom(urlInfo, row); | ||
} | ||
_context.next = 37; | ||
_context.next = 36; | ||
break; | ||
case 36: | ||
case 35: | ||
console.log('Playback bitrate is not changed. The song URL is '.green + row.url); | ||
case 37: | ||
case 36: | ||
newData.push(row); | ||
case 38: | ||
case 37: | ||
_iteratorNormalCompletion = true; | ||
_context.next = 19; | ||
_context.next = 18; | ||
break; | ||
case 41: | ||
_context.next = 47; | ||
case 40: | ||
_context.next = 46; | ||
break; | ||
case 43: | ||
_context.prev = 43; | ||
_context.t2 = _context['catch'](17); | ||
case 42: | ||
_context.prev = 42; | ||
_context.t2 = _context['catch'](16); | ||
_didIteratorError = true; | ||
_iteratorError = _context.t2; | ||
case 47: | ||
case 46: | ||
_context.prev = 46; | ||
_context.prev = 47; | ||
_context.prev = 48; | ||
@@ -142,7 +140,7 @@ if (!_iteratorNormalCompletion && _iterator.return) { | ||
case 50: | ||
_context.prev = 50; | ||
case 49: | ||
_context.prev = 49; | ||
if (!_didIteratorError) { | ||
_context.next = 53; | ||
_context.next = 52; | ||
break; | ||
@@ -153,9 +151,9 @@ } | ||
case 52: | ||
return _context.finish(49); | ||
case 53: | ||
return _context.finish(50); | ||
return _context.finish(46); | ||
case 54: | ||
return _context.finish(47); | ||
case 55: | ||
data["data"] = newData; | ||
@@ -165,31 +163,31 @@ ctx.defaultBody = (0, _stringify2.default)(data); | ||
case 60: | ||
case 59: | ||
if (!/^\/eapi\/song\/enhance\/download\/url/.test(req.url)) { | ||
_context.next = 80; | ||
_context.next = 79; | ||
break; | ||
} | ||
if (!(utils.netease.getDownloadReturnCode(ctx.defaultBody) != 200)) { | ||
_context.next = 76; | ||
if (!(utils.netease.getDownloadReturnCode(data) != 200)) { | ||
_context.next = 75; | ||
break; | ||
} | ||
songId = utils.netease.getDownloadSongId(ctx.defaultBody); | ||
_context.prev = 63; | ||
_context.next = 66; | ||
songId = utils.netease.getDownloadSongId(data); | ||
_context.prev = 62; | ||
_context.next = 65; | ||
return _regenerator2.default.awrap(utils.getUrlInfo(songId)); | ||
case 66: | ||
case 65: | ||
urlInfo = _context.sent; | ||
_context.next = 72; | ||
_context.next = 71; | ||
break; | ||
case 69: | ||
_context.prev = 69; | ||
_context.t3 = _context['catch'](63); | ||
case 68: | ||
_context.prev = 68; | ||
_context.t3 = _context['catch'](62); | ||
return _context.abrupt('return', console.log(_context.t3)); | ||
case 72: | ||
case 71: | ||
if (urlInfo) { | ||
ctx.defaultBody = utils.netease.modifyDownloadApiCustom(urlInfo, ctx.defaultBody); | ||
ctx.defaultBody = utils.netease.modifyDownloadApiCustom(urlInfo, data); | ||
} else { | ||
@@ -200,14 +198,14 @@ console.log('No resource.'.red); | ||
case 76: | ||
console.log('Download bitrate is not changed. The song URL is '.green + utils.netease.getDownloadUrl(ctx.defaultBody).green); | ||
case 75: | ||
console.log('Download bitrate is not changed. The song URL is '.green + utils.netease.getDownloadUrl(data).green); | ||
return _context.abrupt('return', next); | ||
case 78: | ||
_context.next = 81; | ||
case 77: | ||
_context.next = 80; | ||
break; | ||
case 80: | ||
case 79: | ||
return _context.abrupt('return', next); | ||
case 81: | ||
case 80: | ||
case 'end': | ||
@@ -217,5 +215,5 @@ return _context.stop(); | ||
} | ||
}, null, this, [[5, 9], [17, 43, 47, 55], [24, 30], [48,, 50, 54], [63, 69]]); | ||
}, null, this, [[3, 7], [16, 42, 46, 54], [23, 29], [47,, 49, 53], [62, 68]]); | ||
}; | ||
exports.default = modify; |
@@ -47,3 +47,2 @@ 'use strict'; | ||
value: function getDownloadReturnCode(body) { | ||
body = JSON.parse(body); | ||
return body["data"]["code"]; | ||
@@ -54,3 +53,2 @@ } | ||
value: function getDownloadUrl(body) { | ||
body = JSON.parse(body); | ||
return body["data"]["url"]; | ||
@@ -73,3 +71,2 @@ } | ||
value: function getDownloadSongId(body) { | ||
body = JSON.parse(body); | ||
return body["data"]["id"]; | ||
@@ -133,4 +130,2 @@ } | ||
body = JSON.parse(body); | ||
console.log("New URL is ".green + urlInfo.url); | ||
@@ -137,0 +132,0 @@ body["data"]["url"] = urlInfo.url; |
{ | ||
"name": "unblock-netease-music", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "start": "babel-node -- src/bin/unblockneteasemusic -p 8123 -k -q -r", |
# UnblockNeteaseMusic | ||
> 一个基于 koa 的网易云音乐的代理…… | ||
> 一个基于 koa 的网易云音乐的代理,用于海外解锁及替换版权歌曲的播放地址 | ||
@@ -57,3 +57,3 @@ 1. 替换版权曲目播放地址 | ||
新客户端 API 有改动,已经用不了了 | ||
新版客户端现在可以使用该代理解决海外限制,但是无法替换版权歌曲的播放地址。 | ||
@@ -60,0 +60,0 @@ # 预览 |
@@ -11,13 +11,14 @@ import colors from 'colors'; | ||
let songId, | ||
urlInfo; | ||
urlInfo, | ||
data; | ||
try { | ||
data = JSON.parse(ctx.defaultBody.toString()); | ||
} catch (err) { | ||
console.error("Parse JSON failed, return with no modify.".yellow); | ||
return next; | ||
} | ||
if (/^\/eapi\/song\/enhance\/player\/url/.test(req.url)) { | ||
let data = ''; | ||
try { | ||
data = JSON.parse(ctx.defaultBody.toString()); | ||
} catch (err) { | ||
console.error("Parse JSON failed, return with no modify.".yellow); | ||
return next; | ||
} | ||
let newData = []; | ||
@@ -52,4 +53,4 @@ for(let row of data["data"]) { | ||
if (utils.netease.getDownloadReturnCode(ctx.defaultBody) != 200) { | ||
songId = utils.netease.getDownloadSongId(ctx.defaultBody); | ||
if (utils.netease.getDownloadReturnCode(data) != 200) { | ||
songId = utils.netease.getDownloadSongId(data); | ||
try{ | ||
@@ -61,3 +62,3 @@ urlInfo = await utils.getUrlInfo(songId); | ||
if (urlInfo) { | ||
ctx.defaultBody = utils.netease.modifyDownloadApiCustom(urlInfo, ctx.defaultBody); | ||
ctx.defaultBody = utils.netease.modifyDownloadApiCustom(urlInfo, data); | ||
} else { | ||
@@ -68,3 +69,3 @@ console.log('No resource.'.red); | ||
} else { | ||
console.log('Download bitrate is not changed. The song URL is '.green + utils.netease.getDownloadUrl(ctx.defaultBody).green); | ||
console.log('Download bitrate is not changed. The song URL is '.green + utils.netease.getDownloadUrl(data).green); | ||
return next; | ||
@@ -71,0 +72,0 @@ } |
@@ -11,3 +11,2 @@ import colors from 'colors'; | ||
getDownloadReturnCode(body) { | ||
body = JSON.parse(body); | ||
return body["data"]["code"]; | ||
@@ -17,3 +16,2 @@ }; | ||
getDownloadUrl(body) { | ||
body = JSON.parse(body); | ||
return body["data"]["url"]; | ||
@@ -33,3 +31,2 @@ }; | ||
getDownloadSongId(body) { | ||
body = JSON.parse(body); | ||
return body["data"]["id"]; | ||
@@ -90,4 +87,2 @@ }; | ||
body = JSON.parse(body); | ||
console.log("New URL is ".green + urlInfo.url); | ||
@@ -94,0 +89,0 @@ body["data"]["url"] = urlInfo.url; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91643
1406