mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-21 23:21:22 +08:00
add getArtistAblums and getAblums & Update README & Update test & replan directory
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import request from 'request'
|
||||
import { origin, globalOption } from '../config'
|
||||
import { deepCopy } from '../util'
|
||||
|
||||
const getAlbums = (id, callback) => {
|
||||
const option = deepCopy(globalOption)
|
||||
const url = `${origin}/api/album/${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 { getAlbums }
|
||||
@@ -0,0 +1,19 @@
|
||||
import request from 'request'
|
||||
import { origin, globalOption } from '../config'
|
||||
import { deepCopy } from '../util'
|
||||
|
||||
const getArtistAlbums = (id, callback, limit = 3, offset = 0) => {
|
||||
const option = deepCopy(globalOption)
|
||||
const url = `${origin}/api/artist/albums/${id}?offset=${offset}&limit=${limit}`
|
||||
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 { getArtistAlbums }
|
||||
@@ -0,0 +1,19 @@
|
||||
import request from 'request'
|
||||
import { origin, globalOption } from '../config'
|
||||
import { deepCopy } from '../util'
|
||||
|
||||
const lrc = (id, callback = null, lv = -1) => {
|
||||
const option = deepCopy(globalOption)
|
||||
const url = `${origin}/api/song/lyric?lv=${lv}&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 { lrc }
|
||||
@@ -0,0 +1,26 @@
|
||||
import request from 'request'
|
||||
import { origin, globalOption } from '../config'
|
||||
import { deepCopy } from '../util'
|
||||
|
||||
const search = (name = null, callback = null, limit = 3, offset = 0) => {
|
||||
const option = deepCopy(globalOption)
|
||||
const url = `${origin}/api/search/suggest/web`
|
||||
const form = {
|
||||
s: name,
|
||||
limit,
|
||||
type: 1,
|
||||
offset
|
||||
}
|
||||
const method = 'POST'
|
||||
Object.assign(option, { url, form, 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 { search }
|
||||
@@ -0,0 +1,19 @@
|
||||
import request from 'request'
|
||||
import { origin, globalOption } from '../config'
|
||||
import { deepCopy } from '../util'
|
||||
|
||||
const song = (id, callback = null) => {
|
||||
const option = deepCopy(globalOption)
|
||||
const url = `${origin}/api/song/detail?ids=%5B${id}%5d`
|
||||
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 { song }
|
||||
Reference in New Issue
Block a user