mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
增加歌单(网友精选碟),新碟上架,热门歌手等接口,更新文档,版本更新到2.4.0
This commit is contained in:
parent
0911a5b630
commit
0baed1a634
@ -1,4 +1,7 @@
|
||||
# 更新日志
|
||||
### 2.4.0 | 2017.4.20
|
||||
增加歌单(网友精选碟),新碟上架,热门歌手等接口,更新文档
|
||||
|
||||
### 2.3.4 | 2017.4.20
|
||||
增加歌曲详情接口,更新文档
|
||||
|
||||
|
@ -14,6 +14,9 @@
|
||||
[darknessomi/musicbox](https://github.com/darknessomi/musicbox)
|
||||
|
||||
## 版本新特性
|
||||
### 2.4.0 | 2017.4.20
|
||||
增加歌单(网友精选碟),新碟上架,热门歌手等接口,更新文档
|
||||
|
||||
### 2.3.4 | 2017.4.20
|
||||
增加歌曲详情接口,更新文档
|
||||
|
||||
@ -45,6 +48,7 @@
|
||||
13. 把私人 FM 的歌曲移动至垃圾桶
|
||||
14. 签到
|
||||
15. 各排行榜
|
||||
16. 歌曲详情
|
||||
|
||||
## 环境要求
|
||||
需要 NodeJS 6.0+ 环境
|
||||
|
11
app.js
11
app.js
@ -23,7 +23,16 @@ app.use('/lyric', require('./router/lyric'))
|
||||
// 获取专辑
|
||||
app.use('/album', require('./router/album'))
|
||||
|
||||
// 获取歌单
|
||||
// 歌单(网友精选碟) hot||new http://music.163.com/#/discover/playlist/
|
||||
app.use('/top_playlist', require('./router/top_playlist'))
|
||||
|
||||
// 新碟上架 http://music.163.com/#/discover/album/
|
||||
app.use('/new_albums', require('./router/new_albums'))
|
||||
|
||||
// 热门歌手 http://music.163.com/#/discover/artist/
|
||||
app.use('/top_artists', require('./router/top_artists'))
|
||||
|
||||
// 获取用户歌单
|
||||
app.use('/user/playlist', require('./router/userPlaylist'))
|
||||
|
||||
// 获取歌单内列表
|
||||
|
@ -11,6 +11,9 @@
|
||||
跨站请求伪造 (CSRF), 伪造请求头,调用官方 API
|
||||
|
||||
## 版本新特性
|
||||
Version 2.4.0
|
||||
增加歌单(网友精选碟),新碟上架,热门歌手等接口,更新文档
|
||||
|
||||
Version 2.3.4
|
||||
增加歌曲详情接口,更新文档
|
||||
|
||||
@ -37,6 +40,9 @@ Version 2.2.0
|
||||
14. 签到
|
||||
15. 各排行榜
|
||||
16. 歌曲详情
|
||||
17. 歌单(网友精选碟)
|
||||
18. 新碟上架
|
||||
19. 热门歌手
|
||||
|
||||
## 安装
|
||||
``` shell
|
||||
@ -159,7 +165,7 @@ $ set PORT=4000 && node app.js
|
||||
1000: 歌单
|
||||
1002: 用户
|
||||
|
||||
`offset` : 偏移数量,用于分页,如: 如:(评论页数-1)*30, 其中 30 为 limit 的值
|
||||
`offset` : 偏移数量,用于分页,如: 如:(评论页数-1)*30, 其中 30 为 limit 的值,默认为0
|
||||
|
||||
**接口地址:**
|
||||
`/search`
|
||||
@ -299,10 +305,10 @@ $ set PORT=4000 && node app.js
|
||||
### 喜欢音乐
|
||||
说明:调用此接口,传入音乐 id, 可喜欢该音乐
|
||||
**必选参数:**
|
||||
` id`: 歌曲 id
|
||||
`id`: 歌曲 id
|
||||
|
||||
**可选参数:**
|
||||
` like`: 布尔值,默认为 true 即喜欢,若传 false, 则取消喜欢
|
||||
`like`: 布尔值,默认为 true 即喜欢,若传 false, 则取消喜欢
|
||||
|
||||
**接口地址:**
|
||||
`/like`
|
||||
@ -324,7 +330,7 @@ $ set PORT=4000 && node app.js
|
||||
说明:调用此接口,传入音乐 id, 可把该音乐从私人 FM中移除至垃圾桶
|
||||
|
||||
**必选参数:**
|
||||
` id`: 歌曲 id
|
||||
`id`: 歌曲 id
|
||||
|
||||
**接口地址:**
|
||||
`/fm_trash`
|
||||
@ -336,11 +342,67 @@ $ set PORT=4000 && node app.js
|
||||
|
||||

|
||||
|
||||
### 歌单(网友精选碟)
|
||||
说明:调用此接口,可获取网友精选碟歌单
|
||||
|
||||
**可选参数:**
|
||||
`limit`: 取出数量,默认为50
|
||||
|
||||
`offset`: 偏移数量,用于分页,如:(评论页数-1)*20, 其中 20 为 limit 的值,默认为0
|
||||
|
||||
`order`: 可选值为 'new' 和 'hot',分别对应最新和最热,默认为 'hot'
|
||||
|
||||
**接口地址:**
|
||||
`/top_playlist`
|
||||
|
||||
**调用例子:**
|
||||
`/top_playlist?limit=10&order=new`
|
||||
|
||||
返回数据如下图:
|
||||
|
||||

|
||||
|
||||
### 新碟上架
|
||||
说明:调用此接口,可获取新碟上架数据
|
||||
|
||||
**可选参数:**
|
||||
`limit`: 取出数量,默认为50
|
||||
|
||||
`offset`: 偏移数量,用于分页,如:(评论页数-1)*50, 其中 50 为 limit 的值,默认为0
|
||||
|
||||
**接口地址:**
|
||||
`/new_albums`
|
||||
|
||||
**调用例子:**
|
||||
`/new_albums?offset=0&limit=30`
|
||||
|
||||
返回数据如下图:
|
||||
|
||||

|
||||
|
||||
### 热门歌手
|
||||
说明:调用此接口,可获取热门歌手数据
|
||||
|
||||
**可选参数:**
|
||||
`limit`: 取出数量,默认为50
|
||||
|
||||
`offset`: 偏移数量,用于分页,如:(评论页数-1)*50, 其中 50 为 limit 的值,默认为0
|
||||
|
||||
**接口地址:**
|
||||
`/top_artists`
|
||||
|
||||
**调用例子:**
|
||||
`/top_artists?offset=0&limit=30`
|
||||
|
||||
返回数据如下图:
|
||||
|
||||

|
||||
|
||||
### 排行榜
|
||||
说明:调用此接口,传入数字 idx, 可获取不同排行榜
|
||||
|
||||
**必选参数:**
|
||||
` idx`: 对象 key, 对应以下排行榜
|
||||
`idx`: 对象 key, 对应以下排行榜
|
||||
|
||||
```
|
||||
"0": 云音乐新歌榜,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "NeteaseCloudMusicApi",
|
||||
"version": "2.3.4",
|
||||
"version": "2.4.0",
|
||||
"description": "网易云音乐 NodeJS 版 API",
|
||||
"scripts": {
|
||||
"start": "node app.js",
|
||||
|
@ -12,7 +12,7 @@ router.get("/", (req, res) => {
|
||||
const time = req.query.time || 25
|
||||
createWebAPIRequest(
|
||||
'music.163.com',
|
||||
`http://music.163.com/api/radio/trash/add?alg=${alg}&songId=${songid}&time=${time}`,
|
||||
`/api/radio/trash/add?alg=${alg}&songId=${songid}&time=${time}`,
|
||||
'POST',
|
||||
data,
|
||||
cookie,
|
||||
|
@ -13,7 +13,7 @@ router.get("/", (req, res) => {
|
||||
const time = req.query.time || 25
|
||||
createWebAPIRequest(
|
||||
'music.163.com',
|
||||
`http://music.163.com/api/radio/like?alg=${alg}&trackId=${trackId}&like=${like}&time=${time}`,
|
||||
`/api/radio/like?alg=${alg}&trackId=${trackId}&like=${like}&time=${time}`,
|
||||
'POST',
|
||||
data,
|
||||
cookie,
|
||||
|
19
router/new_albums.js
Normal file
19
router/new_albums.js
Normal file
@ -0,0 +1,19 @@
|
||||
const express = require("express")
|
||||
const router = express()
|
||||
const { createRequest } = require("../util/util")
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
const offset = req.query.offset || 0
|
||||
const limit = req.query.limit || 50
|
||||
createRequest(`/api/album/new?area=ALL&offset=${offset}&total=true&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
|
@ -21,12 +21,12 @@ router.get("/", (req, res) => {
|
||||
'POST',
|
||||
data,
|
||||
cookie,
|
||||
music_req=> {
|
||||
music_req => {
|
||||
console.log(music_req)
|
||||
detail = music_req
|
||||
mergeRes()
|
||||
},
|
||||
err =>{
|
||||
err => {
|
||||
res.status(502).send('fetch error')
|
||||
}
|
||||
)
|
||||
|
@ -4,8 +4,7 @@ const { createRequest } = require("../util/util")
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
const ids = req.query.ids
|
||||
console.log(ids)
|
||||
createRequest(`http://music.163.com/api/song/detail?ids=%5B${ids}%5D`, 'GET', null)
|
||||
createRequest(`/api/song/detail?ids=%5B${ids}%5D`, 'GET', null)
|
||||
.then(result => {
|
||||
res.setHeader("Content-Type", "application/json")
|
||||
res.send(result)
|
||||
|
19
router/top_artists.js
Normal file
19
router/top_artists.js
Normal file
@ -0,0 +1,19 @@
|
||||
const express = require("express")
|
||||
const router = express()
|
||||
const { createRequest } = require("../util/util")
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
const offset = req.query.offset || 0
|
||||
const limit = req.query.limit || 50
|
||||
createRequest(`/api/artist/top?offset=${offset}&total=false&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
|
26
router/top_playlist.js
Normal file
26
router/top_playlist.js
Normal file
@ -0,0 +1,26 @@
|
||||
const express = require("express")
|
||||
const router = express()
|
||||
const { createWebAPIRequest } = require("../util/util")
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
const cookie = req.get('Cookie') ? req.get('Cookie') : ''
|
||||
// order可为 'hot' 可为 'new'
|
||||
const data = {
|
||||
cat: req.query.cat || "全部",
|
||||
order: req.query.order || "hot",
|
||||
offset: req.query.offset || 0,
|
||||
total: req.query.offset ? 'true' : 'false',
|
||||
limit: req.query.limit || 50
|
||||
}
|
||||
createWebAPIRequest(
|
||||
'music.163.com',
|
||||
'/api/playlist/list',
|
||||
'POST',
|
||||
data,
|
||||
cookie,
|
||||
music_req => res.send(music_req),
|
||||
err => res.status(502).send('fetch error')
|
||||
)
|
||||
})
|
||||
|
||||
module.exports = router
|
Loading…
x
Reference in New Issue
Block a user