mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2025-10-23 07:33:10 +00:00
commit
79e837cebf
@ -59,6 +59,11 @@ api.getArtistAlbums(id:Number,[callback:function,limit:Number default:3, offset:
|
||||
api.getAlbums(id:Number,[callback:function])
|
||||
```
|
||||
|
||||
## getPlaylists
|
||||
|
||||
``` javascript
|
||||
api.Playlists(id:Number,[callback:function])
|
||||
```
|
||||
|
||||
## License
|
||||
[The MIT License (MIT)](LICENSE)
|
||||
|
@ -15,12 +15,15 @@ var _getArtistAlbums = require('./component/getArtistAlbums');
|
||||
|
||||
var _getAlbums = require('./component/getAlbums');
|
||||
|
||||
var _getPlaylists = require('./component/getPlaylists');
|
||||
|
||||
var api = {
|
||||
search: _search.search,
|
||||
song: _song.song,
|
||||
lrc: _lrc.lrc,
|
||||
getArtistAlbums: _getArtistAlbums.getArtistAlbums,
|
||||
getAlbums: _getAlbums.getAlbums
|
||||
getAlbums: _getAlbums.getAlbums,
|
||||
getPlaylists: _getPlaylists.getPlaylists
|
||||
|
||||
};
|
||||
exports.api = api;
|
32
build/component/getPlaylists
Normal file
32
build/component/getPlaylists
Normal file
@ -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;
|
@ -3,13 +3,15 @@ import { song } from './component/song'
|
||||
import { lrc } from './component/lrc'
|
||||
import { getArtistAlbums } from './component/getArtistAlbums'
|
||||
import { getAlbums } from './component/getAlbums'
|
||||
import { getPlaylists } from './component/getPlaylists'
|
||||
|
||||
let api = {
|
||||
search: search,
|
||||
song: song,
|
||||
lrc: lrc,
|
||||
getArtistAlbums: getArtistAlbums,
|
||||
getAlbums: getAlbums
|
||||
getAlbums: getAlbums,
|
||||
getPlaylists: getPlaylists
|
||||
|
||||
}
|
||||
export {api}
|
||||
|
19
src/component/getPlaylists.js
Normal file
19
src/component/getPlaylists.js
Normal file
@ -0,0 +1,19 @@
|
||||
import request from 'request'
|
||||
import { origin, globalOption } from '../config'
|
||||
import { deepCopy } from '../util'
|
||||
|
||||
const getPlaylists = (id, callback) => {
|
||||
const option = deepCopy(globalOption)
|
||||
const url = `${origin}/api/playlist/detail?id=${id}`
|
||||
const method = 'get'
|
||||
Object.assign(option, {url, method})
|
||||
request(option, (err, res, body) => {
|
||||
if(!err && res.statusCode == 200) {
|
||||
let info = JSON.parse(body)
|
||||
callback && callback(JSON.stringify(info, '', 2))
|
||||
} else {
|
||||
console.error(err);
|
||||
}
|
||||
})
|
||||
}
|
||||
export { Playlists }
|
@ -26,3 +26,8 @@ api.getAlbums('32311', data => {
|
||||
console.log("####################Albums####################")
|
||||
console.log(data)
|
||||
})
|
||||
|
||||
api.getPlaylists('311785002', data => {
|
||||
console.log("####################Playlists####################")
|
||||
console.log(data)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user