mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
增加私人 FM, 喜欢歌曲,垃圾桶,每日签到等接口,更新文档
This commit is contained in:
parent
106fea02bd
commit
6f85779152
@ -1,8 +1,10 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
### 2.2.0 |2017.4.14
|
||||||
|
增加私人 FM, 喜欢歌曲,垃圾桶,每日签到等接口,更新文档
|
||||||
|
|
||||||
## 2.1.3 | 2017.4.6
|
## 2.1.3 | 2017.4.6
|
||||||
改善文档
|
改善文档
|
||||||
|
|
||||||
|
|
||||||
## 2.1.0 | 2017.4.6
|
## 2.1.0 | 2017.4.6
|
||||||
增加获取评论接口以及对应单元测试,增加更新日志
|
增加获取评论接口以及对应单元测试,增加更新日志
|
||||||
|
|
||||||
|
21
README.MD
21
README.MD
@ -8,14 +8,35 @@
|
|||||||
<a href="https://codeclimate.com/github/Binaryify/NeteaseCloudMusicApi"><img src="https://codeclimate.com/github/Binaryify/NeteaseCloudMusicApi/badges/gpa.svg" /></a>
|
<a href="https://codeclimate.com/github/Binaryify/NeteaseCloudMusicApi"><img src="https://codeclimate.com/github/Binaryify/NeteaseCloudMusicApi/badges/gpa.svg" /></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
## 灵感来自
|
||||||
|
[disoul/electron-cloud-music](https://github.com/disoul/electron-cloud-music)
|
||||||
|
|
||||||
|
[darknessomi/musicbox](https://github.com/darknessomi/musicbox)
|
||||||
|
|
||||||
## 版本新特性
|
## 版本新特性
|
||||||
|
### 2.2.0 |2017.4.14
|
||||||
|
增加私人 FM, 喜欢歌曲,垃圾桶,每日签到等接口,更新文档
|
||||||
|
|
||||||
### 2.1.0 | 2017.4.6
|
### 2.1.0 | 2017.4.6
|
||||||
增加获取评论接口以及对应单元测试,增加更新日志
|
增加获取评论接口以及对应单元测试,增加更新日志
|
||||||
|
|
||||||
### 2.0.0 | 2017.4.1
|
### 2.0.0 | 2017.4.1
|
||||||
版本升级到 2.0.增加使用文档,完成项目重构,增加更完善的单元测试,升级 api 到 v2+,支持登录并获取用户信息和创建的歌单,可通过获取音乐 url 接口获取用户歌单里的的音乐,获取每日推荐歌单和每日推荐音乐
|
版本升级到 2.0.增加使用文档,完成项目重构,增加更完善的单元测试,升级 api 到 v2+,支持登录并获取用户信息和创建的歌单,可通过获取音乐 url 接口获取用户歌单里的的音乐,获取每日推荐歌单和每日推荐音乐
|
||||||
|
|
||||||
|
## 功能特性
|
||||||
|
1. 登录
|
||||||
|
2. 获取用户歌单
|
||||||
|
3. 获取歌曲详情
|
||||||
|
4. 获取音乐 url
|
||||||
|
5. 搜索音乐
|
||||||
|
6. 获取歌词
|
||||||
|
7. 获取评论
|
||||||
|
8. 获取歌手专辑
|
||||||
|
9. 获取每日推荐歌单
|
||||||
|
10. 获取每日推荐歌曲
|
||||||
|
11. 喜欢歌曲
|
||||||
|
12. 私人FM
|
||||||
|
13. 把私人 FM 的歌曲移动至垃圾桶
|
||||||
|
|
||||||
## 环境要求
|
## 环境要求
|
||||||
需要 NodeJS 6.0+ 环境
|
需要 NodeJS 6.0+ 环境
|
||||||
|
15
app.js
15
app.js
@ -27,14 +27,29 @@ app.use('/user/playlist', require('./router/userPlaylist'))
|
|||||||
// 获取歌单内列表
|
// 获取歌单内列表
|
||||||
app.use('/playlist/detail', require('./router/playlistDetail'))
|
app.use('/playlist/detail', require('./router/playlistDetail'))
|
||||||
|
|
||||||
|
//不明 api
|
||||||
app.use('/playlist/tracks', require('./router/playlistTracks'))
|
app.use('/playlist/tracks', require('./router/playlistTracks'))
|
||||||
|
|
||||||
// 获取音乐 url
|
// 获取音乐 url
|
||||||
app.use('/music/url', require('./router/musicUrl'))
|
app.use('/music/url', require('./router/musicUrl'))
|
||||||
|
|
||||||
// 搜歌
|
// 搜歌
|
||||||
app.use('/search', require('.//router/search'))
|
app.use('/search', require('.//router/search'))
|
||||||
|
|
||||||
app.use('/log/web', require('./router/logWeb'))
|
app.use('/log/web', require('./router/logWeb'))
|
||||||
|
|
||||||
|
// 私人 FM
|
||||||
|
app.use("/personal_fm",require("./router/personal_fm"))
|
||||||
|
|
||||||
|
// 喜欢歌曲
|
||||||
|
app.use("/like",require("./router/like"))
|
||||||
|
|
||||||
|
//签到
|
||||||
|
app.use("/daily_signin",require("./router/daily_signin"))
|
||||||
|
|
||||||
|
//垃圾桶
|
||||||
|
app.use("/fm_trash",require("./router/fm_trash"))
|
||||||
|
|
||||||
process.on('SIGHUP', () => {
|
process.on('SIGHUP', () => {
|
||||||
console.log('server: bye bye')
|
console.log('server: bye bye')
|
||||||
process.exit()
|
process.exit()
|
||||||
|
@ -4,7 +4,24 @@
|
|||||||
|
|
||||||
|
|
||||||
## 版本新特性
|
## 版本新特性
|
||||||
版本升级到 2.0 .增加使用文档,完成项目重构,增加更完善的单元测试,升级 api 到 v2+,支持登录并获取用户信息和创建的歌单,可通过获取音乐 url 接口获取用户歌单里的的音乐,获取每日推荐歌单和每日推荐音乐
|
Version 2.2.0
|
||||||
|
新增喜欢歌曲,私人 FM, 垃圾桶,签到等接口
|
||||||
|
|
||||||
|
## 功能特性
|
||||||
|
1. 登录
|
||||||
|
2. 获取用户歌单
|
||||||
|
3. 获取歌曲详情
|
||||||
|
4. 获取音乐 url
|
||||||
|
5. 搜索音乐
|
||||||
|
6. 获取歌词
|
||||||
|
7. 获取评论
|
||||||
|
8. 获取歌手专辑
|
||||||
|
9. 获取每日推荐歌单
|
||||||
|
10. 获取每日推荐歌曲
|
||||||
|
11. 喜欢歌曲
|
||||||
|
12. 私人FM
|
||||||
|
13. 把私人 FM 的歌曲移动至垃圾桶
|
||||||
|
14. 签到
|
||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
``` shell
|
``` shell
|
||||||
@ -51,7 +68,7 @@ $ node app.js
|
|||||||

|

|
||||||
|
|
||||||
|
|
||||||
完成登录后,会在浏览器保存一个 cookie 用作登录凭证, 除了搜索的音乐和歌词,以及获取音乐 url 都需要用到这个 cookie
|
完成登录后,会在浏览器保存一个 Cookies 用作登录凭证,大部分 API 都需要用到这个 Cookies
|
||||||
|
|
||||||
#### 注意
|
#### 注意
|
||||||
调用登录接口的速度比调用其他接口慢,因为登录过程调用了加密算法
|
调用登录接口的速度比调用其他接口慢,因为登录过程调用了加密算法
|
||||||
@ -204,6 +221,78 @@ $ node app.js
|
|||||||
返回数据如下图:
|
返回数据如下图:
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
### 私人 FM
|
||||||
|
说明:私人 FM( 需要登录)
|
||||||
|
|
||||||
|
**接口地址:**
|
||||||
|
`/personal_fm`
|
||||||
|
|
||||||
|
**调用例子:**
|
||||||
|
`/personal_fm`
|
||||||
|
|
||||||
|
返回数据如下图:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 签到
|
||||||
|
说明:调用此接口,传入签到类型(可不传,默认安卓端签到),可签到(需要登录),其中安卓端签到可获得3点经验, web/PC 端签到可获得2点经验
|
||||||
|
**可选参数:**
|
||||||
|
`type`: 签到类型,默认 0, 其中 0 为安卓端签到,1为 web/PC 签到
|
||||||
|
|
||||||
|
**接口地址:**
|
||||||
|
`/daily_signin`
|
||||||
|
|
||||||
|
**调用例子:**
|
||||||
|
`/daily_signin`
|
||||||
|
|
||||||
|
返回数据如下图:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### 喜欢音乐
|
||||||
|
说明:调用此接口,传入音乐 id, 可喜欢该音乐
|
||||||
|
**必选参数:**
|
||||||
|
` id`: 歌曲 id
|
||||||
|
|
||||||
|
**可选参数:**
|
||||||
|
` like`: 布尔值,默认为 true 即喜欢,若传 false, 则取消喜欢
|
||||||
|
|
||||||
|
**接口地址:**
|
||||||
|
`/like`
|
||||||
|
|
||||||
|
**调用例子:**
|
||||||
|
`/like?id=347230`
|
||||||
|
|
||||||
|
返回数据如下图:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
喜欢成功则返回数据的 code 为200,其余为失败
|
||||||
|
|
||||||
|
### 垃圾桶
|
||||||
|
说明:调用此接口,传入音乐 id, 可把该音乐从私人 FM中移除至垃圾桶
|
||||||
|
|
||||||
|
**必选参数:**
|
||||||
|
` id`: 歌曲 id
|
||||||
|
|
||||||
|
**接口地址:**
|
||||||
|
`/fm_trash`
|
||||||
|
|
||||||
|
**调用例子:**
|
||||||
|
`/fm_trash?id=347230`
|
||||||
|
|
||||||
|
返回数据如下图:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 离线访问此文档
|
## 离线访问此文档
|
||||||
此文档同时也是 Progressive Web Apps(PWA), 加入了serviceWorker,可离线访问
|
此文档同时也是 Progressive Web Apps(PWA), 加入了serviceWorker,可离线访问
|
||||||
|
|
||||||
|
29
router/daily_signin.js
Normal file
29
router/daily_signin.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
const express = require("express")
|
||||||
|
const router = express()
|
||||||
|
const { createWebAPIRequest } = require("../util/util")
|
||||||
|
|
||||||
|
router.get("/", (req, res) => {
|
||||||
|
const cookie = req.get('Cookie') ? req.get('Cookie') : ''
|
||||||
|
const data = {
|
||||||
|
"csrf_token": ""
|
||||||
|
}
|
||||||
|
// {'android': {'point': 3, 'code': 200}, 'web': {'point': 2, 'code': 200}}
|
||||||
|
// {'android': {'code': -2, 'msg': '重复签到'}, 'web': {'code': -2, 'msg': '重复签到'}}
|
||||||
|
// 'android': {'code': 301}, 'web': {'code': 301}}
|
||||||
|
|
||||||
|
let type = req.query.type || 0 //0为安卓端签到 3点经验,1为网页签到,2点经验
|
||||||
|
const action = `http://music.163.com/weapi/point/dailyTask?type=${type}`
|
||||||
|
createWebAPIRequest(
|
||||||
|
'music.163.com',
|
||||||
|
action,
|
||||||
|
'POST',
|
||||||
|
data,
|
||||||
|
cookie,
|
||||||
|
music_req => res.send(music_req),
|
||||||
|
err => res.status(502).send('fetch error')
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = router
|
26
router/fm_trash.js
Normal file
26
router/fm_trash.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') : ''
|
||||||
|
const data = {
|
||||||
|
"csrf_token": ""
|
||||||
|
}
|
||||||
|
const songid = req.query.id
|
||||||
|
const alg = "RT"
|
||||||
|
const time = req.query.time || 25
|
||||||
|
createWebAPIRequest(
|
||||||
|
'music.163.com',
|
||||||
|
`http://music.163.com/api/radio/trash/add?alg=${alg}&songId=${songid}&time=${time}`,
|
||||||
|
'POST',
|
||||||
|
data,
|
||||||
|
cookie,
|
||||||
|
music_req => res.send(music_req),
|
||||||
|
err => res.status(502).send('fetch error')
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = router
|
27
router/like.js
Normal file
27
router/like.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
const express = require("express")
|
||||||
|
const router = express()
|
||||||
|
const { createWebAPIRequest } = require("../util/util")
|
||||||
|
|
||||||
|
router.get("/", (req, res) => {
|
||||||
|
const cookie = req.get('Cookie') ? req.get('Cookie') : ''
|
||||||
|
const data = {
|
||||||
|
"csrf_token": ""
|
||||||
|
}
|
||||||
|
const trackId = req.query.id
|
||||||
|
const like = req.query.like || true
|
||||||
|
const alg = "itembased"
|
||||||
|
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}`,
|
||||||
|
'POST',
|
||||||
|
data,
|
||||||
|
cookie,
|
||||||
|
music_req => res.send(music_req),
|
||||||
|
err => res.status(502).send('fetch error')
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = router
|
24
router/personal_fm.js
Normal file
24
router/personal_fm.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
const express = require("express")
|
||||||
|
const router = express()
|
||||||
|
const { createWebAPIRequest } = require("../util/util")
|
||||||
|
|
||||||
|
router.get("/", (req, res) => {
|
||||||
|
const cookie = req.get('Cookie') ? req.get('Cookie') : ''
|
||||||
|
const data = {
|
||||||
|
"csrf_token": ""
|
||||||
|
}
|
||||||
|
|
||||||
|
createWebAPIRequest(
|
||||||
|
'music.163.com',
|
||||||
|
'http://music.163.com/api/radio/get',
|
||||||
|
'POST',
|
||||||
|
data,
|
||||||
|
cookie,
|
||||||
|
music_req => res.send(music_req),
|
||||||
|
err => res.status(502).send('fetch error')
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = router
|
BIN
static/fm_trash.png
Normal file
BIN
static/fm_trash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 KiB |
BIN
static/like.png
Normal file
BIN
static/like.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 197 KiB |
BIN
static/likeSuccess.png
Normal file
BIN
static/likeSuccess.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
static/personal_fm.png
Normal file
BIN
static/personal_fm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 397 KiB |
BIN
static/signinError.png
Normal file
BIN
static/signinError.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 157 KiB |
BIN
static/signinSuccess.png
Normal file
BIN
static/signinSuccess.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 169 KiB |
Loading…
x
Reference in New Issue
Block a user