mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-03 16:52:10 +08:00
Add getPlaylists
This commit is contained in:
parent
c2460b0369
commit
86e54c0032
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 }
|
Loading…
x
Reference in New Issue
Block a user