mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-07-03 07:02:10 +08:00
增加歌手单曲和歌手专辑接口,修复/album 接口描述错误
This commit is contained in:
parent
f8bbf7a29b
commit
f47851cb75
12
app.js
12
app.js
@ -20,9 +20,16 @@ app.use('/recommend/resource', require('./router/recommendResource'))
|
||||
// 获取歌词
|
||||
app.use('/lyric', require('./router/lyric'))
|
||||
|
||||
// 获取专辑
|
||||
// 获取专辑内容
|
||||
app.use('/album', require('./router/album'))
|
||||
|
||||
// 获取歌手单曲
|
||||
app.use('/artists', require('./router/artists'))
|
||||
|
||||
|
||||
// 获取歌手专辑列表
|
||||
app.use('/artist_album', require('./router/artist_album'))
|
||||
|
||||
// 歌单(网友精选碟) hot||new http://music.163.com/#/discover/playlist/
|
||||
app.use('/top_playlist', require('./router/top_playlist'))
|
||||
|
||||
@ -71,9 +78,6 @@ app.use("/top_list",require("./router/top_list"))
|
||||
//mv
|
||||
app.use("/mv",require("./router/mv"))
|
||||
|
||||
//播放mv
|
||||
app.use("/play_mv",require("./router/play_mv"))
|
||||
|
||||
process.on('SIGHUP', () => {
|
||||
console.log('server: bye bye')
|
||||
process.exit()
|
||||
|
@ -31,7 +31,7 @@ Version 2.2.0
|
||||
5. 搜索音乐
|
||||
6. 获取歌词
|
||||
7. 获取评论
|
||||
8. 获取歌手专辑
|
||||
8. 获取专辑内容
|
||||
9. 获取每日推荐歌单
|
||||
10. 获取每日推荐歌曲
|
||||
11. 喜欢歌曲
|
||||
@ -43,7 +43,9 @@ Version 2.2.0
|
||||
17. 歌单(网友精选碟)
|
||||
18. 新碟上架
|
||||
19. 热门歌手
|
||||
20. mv
|
||||
20. mv(可获得 mv 地址,不过暂时还没解决 mv 的防盗链问题)
|
||||
21. 获取歌手专辑
|
||||
22. 获取歌手单曲
|
||||
|
||||
## 安装
|
||||
``` shell
|
||||
@ -151,8 +153,8 @@ $ set PORT=4000 && node app.js
|
||||
返回数据如下图:
|
||||

|
||||
|
||||
### 搜索音乐
|
||||
说明:调用此接口,传入搜索关键词可以搜索该音乐,关键词可以多个,以空格隔开,如"周杰伦 搁浅"(不需要登录)
|
||||
### 搜索
|
||||
说明:调用此接口,传入搜索关键词可以搜索该音乐/专辑/歌手/歌单/用户,关键词可以多个,以空格隔开,如"周杰伦 搁浅"(不需要登录)
|
||||
|
||||
**必选参数:**
|
||||
`keywords` : 关键词
|
||||
@ -190,7 +192,7 @@ $ set PORT=4000 && node app.js
|
||||
`/lyric?id=347230`
|
||||
|
||||
返回数据如下图:
|
||||

|
||||

|
||||
|
||||
### 获取评论
|
||||
说明:调用此接口,传入歌音乐 id和 limit 参数, 可获得该音乐的所有评论(不需要登录)
|
||||
@ -239,13 +241,40 @@ $ set PORT=4000 && node app.js
|
||||
`/album`
|
||||
|
||||
**调用例子:**
|
||||
`album?id=32311`
|
||||
`/album?id=32311`
|
||||
|
||||
返回数据如下图:
|
||||

|
||||

|
||||
|
||||
### 获取歌手单曲
|
||||
说明:调用此接口,传入歌手id,可获得歌手单曲
|
||||
|
||||
**必选参数:**
|
||||
`id`: 歌手id,可由搜索接口获得
|
||||
|
||||
**接口地址:**
|
||||
`/artists`
|
||||
|
||||
**调用例子:**
|
||||
`/artists?id=6452`
|
||||
|
||||
返回数据如下图:
|
||||

|
||||
|
||||
### 获取歌手专辑
|
||||
说明:调用此接口,传入歌手 id,可获得歌手专辑内容
|
||||
|
||||
**必选参数:**
|
||||
`id`: 歌手id
|
||||
|
||||
**接口地址:**
|
||||
`/artist_album`
|
||||
|
||||
**调用例子:**
|
||||
`/artist_album?id=6452&limit=30`
|
||||
|
||||
返回数据如下图:
|
||||

|
||||
|
||||
### 获取每日推荐歌单
|
||||
说明:调用此接口,可获得每日推荐歌单(需要登录)
|
||||
@ -257,7 +286,7 @@ $ set PORT=4000 && node app.js
|
||||
`/recommend/resource`
|
||||
|
||||
返回数据如下图:
|
||||

|
||||

|
||||
|
||||
### 获取每日推荐歌曲
|
||||
说明:调用此接口,可获得每日推荐歌曲(需要登录)
|
||||
@ -269,7 +298,7 @@ $ set PORT=4000 && node app.js
|
||||
`/recommend/songs`
|
||||
|
||||
返回数据如下图:
|
||||

|
||||

|
||||
|
||||
|
||||
### 私人 FM
|
||||
|
20
router/artist_album.js
Normal file
20
router/artist_album.js
Normal file
@ -0,0 +1,20 @@
|
||||
const express = require("express")
|
||||
const router = express()
|
||||
const { createRequest } = require("../util/util")
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
const id = req.query.id
|
||||
const offset = req.query.offset || 0
|
||||
const limit = req.query.limit || 50
|
||||
createRequest(`/api/artist/albums/${id}?offset=${offset}&limit=${limit}`, 'GET', null)
|
||||
.then(result => {
|
||||
res.setHeader("Content-Type", "application/json")
|
||||
res.send(result)
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(502).send('fetch error')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
module.exports = router
|
20
router/artists.js
Normal file
20
router/artists.js
Normal file
@ -0,0 +1,20 @@
|
||||
const express = require("express")
|
||||
const router = express()
|
||||
const { createRequest } = require("../util/util")
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
const id = req.query.id
|
||||
const offset = req.query.offset || 0
|
||||
const limit = req.query.limit || 50
|
||||
createRequest(`/api/artist/${id}?offset=${offset}&limit=${limit}`, 'GET', null)
|
||||
.then(result => {
|
||||
res.setHeader("Content-Type", "application/json")
|
||||
res.send(result)
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(502).send('fetch error')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
module.exports = router
|
@ -1,38 +0,0 @@
|
||||
const express = require("express")
|
||||
const router = express()
|
||||
const request = require("request")
|
||||
const http = require('http')
|
||||
router.get("/", (req, res) => {
|
||||
let ne_req = ''
|
||||
let arr=[]
|
||||
const url = "http://v4.music.126.net/20170421073027/3685c14b705852a3e16b3a5bd73f0d74/web/cloudmusic/MjQ3NDQ3MjUw/89a6a279dc2acfcd068b45ce72b1f560/bf2750483ed02d4c6263dffefa5959d7.mp4"
|
||||
const options = {
|
||||
url: url,
|
||||
headers: {
|
||||
'Referer': 'music.163.com',
|
||||
'Accept': '*/*',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.8,gl;q=0.6,zh-TW;q=0.4',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Type': 'video/mp4',
|
||||
'Referer': 'http://music.163.com',
|
||||
'Host': 'music.163.com',
|
||||
'Cookie': req.get('Cookie') ? req.get('Cookie') : '',
|
||||
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36',
|
||||
}
|
||||
}
|
||||
console.log(options)
|
||||
const pipe=request(options)
|
||||
pipe.on('error', function (err) {
|
||||
console.log(err)
|
||||
})
|
||||
pipe.on('data',data=>{
|
||||
console.log(111)
|
||||
arr.push(data)
|
||||
})
|
||||
pipe.on('end',()=>{
|
||||
const d=Buffer.concat(arr)
|
||||
res.send(d)
|
||||
})
|
||||
})
|
||||
|
||||
module.exports = router
|
@ -7,7 +7,7 @@ router.get("/", (req, res) => {
|
||||
const type = req.query.type || 1
|
||||
const limit = req.query.limit || 30
|
||||
const offset = req.query.offset || 0
|
||||
|
||||
// 搜索单曲(1),歌手(100),专辑(10),歌单(1000),用户(1002) *(type)*
|
||||
const data = 's=' + keywords + '&limit=' + limit + '&type=' + type + '&offset=' + offset
|
||||
createRequest('/api/search/pc/', 'POST', data)
|
||||
.then(result => {
|
||||
|
BIN
static/artist_album.png
Normal file
BIN
static/artist_album.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 345 KiB |
BIN
static/artists.png
Normal file
BIN
static/artists.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 336 KiB |
Loading…
x
Reference in New Issue
Block a user