From dc2abbc96d3578820454fabb5af8ccd28d28515a Mon Sep 17 00:00:00 2001 From: binaryify <821374382@qq.com> Date: Fri, 19 Aug 2016 18:04:45 +0800 Subject: [PATCH] 'update' --- build/component/getPlaylists | 32 ++++++++++++++++++++++++++++++++ package.json | 2 +- test/test.js | 3 ++- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 build/component/getPlaylists diff --git a/build/component/getPlaylists b/build/component/getPlaylists new file mode 100644 index 0000000..3be62f2 --- /dev/null +++ b/build/component/getPlaylists @@ -0,0 +1,32 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getAlbums = undefined; + +var _request = require('request'); + +var _request2 = _interopRequireDefault(_request); + +var _config = require('../config'); + +var _util = require('../util'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var getPlaylists = function getPlaylists(id, callback) { + var option = (0, _util.deepCopy)(_config.globalOption); + var url = _config.origin + '/api/playlist/detail?id=' + id; + var method = 'get'; + Object.assign(option, { url: url, method: method }); + (0, _request2.default)(option, function (err, res, body) { + if (!err && res.statusCode == 200) { + var info = JSON.parse(body); + callback && callback(JSON.stringify(info, '', 2)); + } else { + console.error(err); + } + }); +}; +exports.getPlaylists = getPlaylists; diff --git a/package.json b/package.json index 02dee88..f8d1056 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NeteaseCloudMusicApi", - "version": "1.5.0", + "version": "1.5.1", "description": "网易云音乐nodejs版接口模块", "main": "build/app.js", "scripts": { diff --git a/test/test.js b/test/test.js index 4e88aea..e4ec9d6 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,6 @@ // import { api } from '../src/app.js' -const {api}=require('../build/app.js') +// const { api } =require('../src/app.js') +var api=require('../build/app.js').api api.search("年度之歌",data => { console.log("################Search API#################") console.log(data) -- GitLab