From af7e5aac89ff42fbbe157ca340d5d51722ec2b1e Mon Sep 17 00:00:00 2001
From: binaryify <821374382@qq.com>
Date: Fri, 1 Jul 2016 13:18:00 +0800
Subject: [PATCH] update
---
README.MD | 2 +-
build/app.js | 108 +++++++++++++++++++++++++-----------------------
build/config.js | 13 +++---
npm-debug.log | 48 +++++++++++++++++++++
package.json | 4 +-
src/app.js | 41 +++++++++---------
src/config.js | 3 +-
src/util.js | 2 +-
8 files changed, 137 insertions(+), 84 deletions(-)
create mode 100644 npm-debug.log
diff --git a/README.MD b/README.MD
index ce8a1fe..2e6fc09 100644
--- a/README.MD
+++ b/README.MD
@@ -1,5 +1,5 @@
# NeteaseCloudMusicApi
-
+
一个调用网易云音乐 API 的 node 模块

diff --git a/build/app.js b/build/app.js
index a08900c..19693e0 100644
--- a/build/app.js
+++ b/build/app.js
@@ -1,7 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
- value: true
+ value: true
});
exports.api = undefined;
@@ -16,57 +16,63 @@ var _util = require('./util');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var api = {
- search: function search() {
- var name = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
- var callback = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
- var limit = arguments.length <= 2 || arguments[2] === undefined ? 3 : arguments[2];
- var offset = arguments.length <= 3 || arguments[3] === undefined ? 0 : arguments[3];
+ search: function search() {
+ var name = arguments.length <= 0 || arguments[0] === undefined ? null : arguments[0];
+ var callback = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
+ var limit = arguments.length <= 2 || arguments[2] === undefined ? 3 : arguments[2];
+ var offset = arguments.length <= 3 || arguments[3] === undefined ? 0 : arguments[3];
- var option = (0, _util.deepCopy)(_config.globalOption);
- var url = _config.origin + '/api/search/suggest/web';
- var form = {
- s: name,
- limit: limit,
- type: 1,
- offset: offset
- };
- var method = 'POST';
- Object.assign(option, { url: url, form: form, method: method });
- (0, _request2.default)(option, function (error, response, body) {
- if (!error && response.statusCode == 200) {
- var info = JSON.parse(body);
- callback && callback(JSON.stringify(info, '', 2));
- }
- });
- },
- song: function song(id) {
- var callback = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
+ var option = (0, _util.deepCopy)(_config.globalOption);
+ var url = _config.origin + '/api/search/suggest/web';
+ var form = {
+ s: name,
+ limit: limit,
+ type: 1,
+ offset: offset
+ };
+ var method = 'POST';
+ Object.assign(option, { url: url, form: form, method: method });
+ (0, _request2.default)(option, function (error, response, body) {
+ if (!error && response.statusCode == 200) {
+ var info = JSON.parse(body);
+ callback && callback(JSON.stringify(info, '', 2));
+ } else {
+ console.log(error);
+ }
+ });
+ },
+ song: function song(id) {
+ var callback = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
- var option = (0, _util.deepCopy)(_config.globalOption);
- var url = _config.origin + '/api/song/detail?ids=%5B' + id + '%5d';
- var method = 'GET';
- Object.assign(option, { url: url, method: method });
- (0, _request2.default)(option, function (error, response, body) {
- if (!error && response.statusCode == 200) {
- var info = JSON.parse(body);
- callback && callback(JSON.stringify(info, '', 2));
- }
- });
- },
- lrc: function lrc(id) {
- var callback = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
- var lv = arguments.length <= 2 || arguments[2] === undefined ? -1 : arguments[2];
+ var option = (0, _util.deepCopy)(_config.globalOption);
+ var url = _config.origin + '/api/song/detail?ids=%5B' + id + '%5d';
+ var method = 'GET';
+ Object.assign(option, { url: url, method: method });
+ (0, _request2.default)(option, function (error, response, body) {
+ if (!error && response.statusCode == 200) {
+ var info = JSON.parse(body);
+ callback && callback(JSON.stringify(info, '', 2));
+ } else {
+ console.log(error);
+ }
+ });
+ },
+ lrc: function lrc(id) {
+ var callback = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
+ var lv = arguments.length <= 2 || arguments[2] === undefined ? -1 : arguments[2];
- var option = (0, _util.deepCopy)(_config.globalOption);
- var url = _config.origin + '/api/song/lyric?lv=' + lv + '&id=' + id;
- var method = 'GET';
- Object.assign(option, { url: url, method: method });
- (0, _request2.default)(option, function (error, response, body) {
- if (!error && response.statusCode == 200) {
- var info = JSON.parse(body);
- callback && callback(JSON.stringify(info, '', 2));
- }
- });
- }
+ var option = (0, _util.deepCopy)(_config.globalOption);
+ var url = _config.origin + '/api/song/lyric?lv=' + lv + '&id=' + id;
+ var method = 'GET';
+ Object.assign(option, { url: url, method: method });
+ (0, _request2.default)(option, function (error, response, body) {
+ if (!error && response.statusCode == 200) {
+ var info = JSON.parse(body);
+ callback && callback(JSON.stringify(info, '', 2));
+ } else {
+ console.log(error);
+ }
+ });
+ }
};
-exports.api = api;
+exports.api = api;
\ No newline at end of file
diff --git a/build/config.js b/build/config.js
index e0c9f47..7a686ef 100644
--- a/build/config.js
+++ b/build/config.js
@@ -1,16 +1,17 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
- value: true
+ value: true
});
var origin = 'http://music.163.com';
var globalOption = {
- headers: {
- 'Origin': origin,
- 'Referer': origin,
- 'Content-Type': 'application/x-www-form-urlencoded'
- }
+ headers: {
+ 'Origin': origin,
+ 'Referer': origin,
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ },
+ proxy: false
};
exports.origin = origin;
diff --git a/npm-debug.log b/npm-debug.log
new file mode 100644
index 0000000..08414c2
--- /dev/null
+++ b/npm-debug.log
@@ -0,0 +1,48 @@
+0 info it worked if it ends with ok
+1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
+1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
+1 verbose cli 'run',
+1 verbose cli 'test' ]
+2 info using npm@3.9.5
+3 info using node@v6.2.2
+4 verbose run-script [ 'pretest', 'test', 'posttest' ]
+5 info lifecycle NeteaseCloudMusicApi@1.2.2~pretest: NeteaseCloudMusicApi@1.2.2
+6 silly lifecycle NeteaseCloudMusicApi@1.2.2~pretest: no script for pretest, continuing
+7 info lifecycle NeteaseCloudMusicApi@1.2.2~test: NeteaseCloudMusicApi@1.2.2
+8 verbose lifecycle NeteaseCloudMusicApi@1.2.2~test: unsafe-perm in lifecycle true
+9 verbose lifecycle NeteaseCloudMusicApi@1.2.2~test: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\ztf\Desktop\NeteaseCloudMusicApi\node_modules\.bin;C:\Program Files\nodejs;C:\Users\ztf\bin;C:\Program Files (x86)\Git\mingw32\bin;C:\Program Files (x86)\Git\usr\local\bin;C:\Program Files (x86)\Git\usr\bin;C:\Program Files (x86)\Git\usr\bin;C:\Program Files (x86)\Git\mingw32\bin;C:\Program Files (x86)\Git\usr\bin;C:\Users\ztf\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Users\ztf\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Java\jdk1.8.0_92\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\OpenVPN\bin;C:\Program Files\nodejs;C:\Program Files (x86)\Tesseract-OCR;C:\Users\ztf\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\ztf\AppData\Local\atom\bin;C:\ProgramData\chocolatey\bin;C:\Users\ztf\AppData\Local\Android\sdk\tools;C:\Users\ztf\AppData\Local\Android\sdk\platform-tools;C:\Users\ztf\AppData\Local\Microsoft\WindowsApps;C:\Python34;C:\Python34\Scripts;C:\Program Files (x86)\Git\cmd;D:\software\aria2\aria2c.exe;C:\Program Files (x86)\Git;C:\Users\ztf\AppData\Roaming\npm;C:\Program Files (x86)\WinRAR;C:\Program Files (x86)\Git\usr\bin\vendor_perl;C:\Program Files (x86)\Git\usr\bin\core_perl
+10 verbose lifecycle NeteaseCloudMusicApi@1.2.2~test: CWD: C:\Users\ztf\Desktop\NeteaseCloudMusicApi
+11 silly lifecycle NeteaseCloudMusicApi@1.2.2~test: Args: [ '/d /s /c', 'babel-node test/test.js' ]
+12 silly lifecycle NeteaseCloudMusicApi@1.2.2~test: Returned: code: 1 signal: null
+13 info lifecycle NeteaseCloudMusicApi@1.2.2~test: Failed to exec test script
+14 verbose stack Error: NeteaseCloudMusicApi@1.2.2 test: `babel-node test/test.js`
+14 verbose stack Exit status 1
+14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:245:16)
+14 verbose stack at emitTwo (events.js:106:13)
+14 verbose stack at EventEmitter.emit (events.js:191:7)
+14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
+14 verbose stack at emitTwo (events.js:106:13)
+14 verbose stack at ChildProcess.emit (events.js:191:7)
+14 verbose stack at maybeClose (internal/child_process.js:852:16)
+14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
+15 verbose pkgid NeteaseCloudMusicApi@1.2.2
+16 verbose cwd C:\Users\ztf\Desktop\NeteaseCloudMusicApi
+17 error Windows_NT 10.0.14376
+18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
+19 error node v6.2.2
+20 error npm v3.9.5
+21 error code ELIFECYCLE
+22 error NeteaseCloudMusicApi@1.2.2 test: `babel-node test/test.js`
+22 error Exit status 1
+23 error Failed at the NeteaseCloudMusicApi@1.2.2 test script 'babel-node test/test.js'.
+23 error Make sure you have the latest version of node.js and npm installed.
+23 error If you do, this is most likely a problem with the NeteaseCloudMusicApi package,
+23 error not with npm itself.
+23 error Tell the author that this fails on your system:
+23 error babel-node test/test.js
+23 error You can get information on how to open an issue for this project with:
+23 error npm bugs NeteaseCloudMusicApi
+23 error Or if that isn't available, you can get their info via:
+23 error npm owner ls NeteaseCloudMusicApi
+23 error There is likely additional logging output above.
+24 verbose exit [ 1, true ]
diff --git a/package.json b/package.json
index e5e5ce4..b0cfe16 100644
--- a/package.json
+++ b/package.json
@@ -1,13 +1,13 @@
{
"name": "NeteaseCloudMusicApi",
- "version": "1.2.1",
+ "version": "1.2.3",
"description": "网易云音乐nodejs版接口模块",
"main": "build/app.js",
"scripts": {
"test": "babel-node test/test.js",
"build": "babel src/ -d build/"
},
- "keywords": ["NeteaseCloudMusic","网易云音乐"],
+ "keywords": ["NeteaseCloudMusic","网易云音乐","网易云"],
"author": "traveller",
"license": "ISC",
"dependencies": {
diff --git a/src/app.js b/src/app.js
index 9799751..594fc71 100644
--- a/src/app.js
+++ b/src/app.js
@@ -4,32 +4,30 @@ import { deepCopy } from './util'
let api = {
search: (name = null, callback = null, limit = 3, offset = 0) => {
- let option = deepCopy(globalOption)
- let url = origin + '/api/search/suggest/web'
- let form = {
- s: name,
- limit,
- type: 1,
- offset
- }
- let method = 'POST'
- let proxy = false
- Object.assign(option, { url, form, method, proxy })
- request(option, (error, response, body) => {
- if (!error && response.statusCode == 200) {
- let info = JSON.parse(body);
- callback && callback(JSON.stringify(info, '', 2))
- } else {
- console.log(error)
+ let option = deepCopy(globalOption)
+ let url = origin + '/api/search/suggest/web'
+ let form = {
+ s: name,
+ limit,
+ type: 1,
+ offset
}
- })
+ let method = 'POST'
+ Object.assign(option, { url, form, method })
+ request(option, (error, response, body) => {
+ if (!error && response.statusCode == 200) {
+ let info = JSON.parse(body);
+ callback && callback(JSON.stringify(info, '', 2))
+ } else {
+ console.log(error)
+ }
+ })
},
song: (id, callback = null) => {
let option = deepCopy(globalOption)
let url = origin + '/api/song/detail?ids=%5B' + id + '%5d'
let method = 'GET'
- let proxy = false
- Object.assign(option, { url, method, proxy })
+ Object.assign(option, { url, method })
request(option, (error, response, body) => {
if (!error && response.statusCode == 200) {
let info = JSON.parse(body);
@@ -43,8 +41,7 @@ let api = {
let option = deepCopy(globalOption)
let url = origin + '/api/song/lyric?lv=' + lv + '&id=' + id
let method = 'GET'
- let proxy = false
- Object.assign(option, { url, method, proxy })
+ Object.assign(option, { url, method })
request(option, (error, response, body) => {
if (!error && response.statusCode == 200) {
let info = JSON.parse(body);
diff --git a/src/config.js b/src/config.js
index 0b692d9..5d52d4e 100644
--- a/src/config.js
+++ b/src/config.js
@@ -5,7 +5,8 @@ const globalOption = {
'Origin': origin,
'Referer': origin,
'Content-Type': 'application/x-www-form-urlencoded'
- }
+ },
+ proxy:false
}
export { origin, globalOption }
diff --git a/src/util.js b/src/util.js
index b1dced6..c33769a 100644
--- a/src/util.js
+++ b/src/util.js
@@ -1,3 +1,3 @@
-const deepCopy = (obj) => JSON.parse(JSON.stringify(obj))
+const deepCopy = obj => JSON.parse(JSON.stringify(obj))
export { deepCopy }