Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_47285076
NeteaseCloudMusicApi_nicole-n
提交
77f848b7
N
NeteaseCloudMusicApi_nicole-n
项目概览
weixin_47285076
/
NeteaseCloudMusicApi_nicole-n
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NeteaseCloudMusicApi_nicole-n
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
77f848b7
编写于
4月 06, 2017
作者:
B
binaryify
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加获取评论接口以及对应单元测试,增加更新日志
上级
1eb6f3a5
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
177 addition
and
35 deletion
+177
-35
CHANGELOG.MD
CHANGELOG.MD
+3
-0
README.MD
README.MD
+2
-0
app.js
app.js
+8
-1
docs/README.md
docs/README.md
+106
-32
package.json
package.json
+2
-2
router/comment.js
router/comment.js
+25
-0
test/comment.test.js
test/comment.test.js
+31
-0
未找到文件。
CHANGELOG.MD
0 → 100644
浏览文件 @
77f848b7
# 更新日志
## 2.1.0 | 2017.4.6
增加获取评论接口以及对应单元测试,增加更新日志
README.MD
浏览文件 @
77f848b7
...
...
@@ -29,6 +29,8 @@ $ node app.js
[
文档地址
](
https://binaryify.github.io/NeteaseCloudMusicApi
)
## 更新日志
[
看这里
](
https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/CHANGELOG.MD
)
## 单元测试
```
shell
...
...
app.js
浏览文件 @
77f848b7
...
...
@@ -5,19 +5,26 @@ const app = express()
//手机登录
app
.
use
(
'
/login/cellphone
'
,
require
(
'
./router/loginCellphone
'
))
//邮箱登录
app
.
use
(
'
/login
'
,
require
(
'
./router/login
'
))
//获取评论
app
.
use
(
'
/comment
'
,
require
(
'
./router/comment
'
))
// 获取每日推荐歌曲
app
.
use
(
'
/recommend/songs
'
,
require
(
'
./router/recommendSongs
'
))
// 获取每日推荐歌单
app
.
use
(
'
/recommend/resource
'
,
require
(
'
./router/recommendResource
'
))
// 获取歌词
app
.
use
(
'
/lyric
'
,
require
(
'
./router/lyric
'
))
// 获取专辑
app
.
use
(
'
/album
'
,
require
(
'
./router/album
'
))
// 获取歌单
app
.
use
(
'
/user/playlist
'
,
require
(
'
./router/userPlaylist
'
))
// 获取歌单内列表
app
.
use
(
'
/playlist/detail
'
,
require
(
'
./router/playlistDetail
'
))
app
.
use
(
'
/playlist/tracks
'
,
require
(
'
./router/playlistTracks
'
))
...
...
docs/README.md
浏览文件 @
77f848b7
...
...
@@ -22,16 +22,31 @@ $ node app.js
## 接口文档
### 登录
登录有两个接口
1.
手机登录
接口地址:
说明:登录有两个接口
#### 1. 手机登录
**必选参数:**
`phone`
: 手机号码
`password`
: 密码
**接口地址:**
`/login/cellphone`
调用例子:
**调用例子:**
`/login/cellphone?phone=xxx&password=yyy`
2.
邮箱登录
接口地址:
`/login`
调用例子:
#### 2. 邮箱登录
**必选参数:**
`email`
: 163网易邮箱
`password`
: 密码
**接口地址:**
`/login`
**调用例子:**
`/login?email=xxx@163.com&password=yyy`
返回数据如下图:
![
登录
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E7%99%BB%E5%BD%95.png
)
...
...
@@ -43,68 +58,121 @@ $ node app.js
### 获取用户歌单
说明:登陆后调用此接口,传入用户 id, 可以获取用户歌单
接口地址:
**必选参数:**
`uid`
: 用户 id
**接口地址:**
`/user/playlist`
调用例子:
**调用例子:**
`/user/playlist?uid=32953014`
返回数据如下图:
![
用户歌单
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E7%94%A8%E6%88%B7%E6%AD%8C%E5%8D%95.png
)
### 获取歌单详情
说明:歌单能看到歌单名字,但看不到具体歌单内容,调用此接口,传入歌单 id,可以获取对应歌单内的所有的音乐
接口地址:
**必选参数:**
`id`
: 歌单 id
**接口地址:**
`playlist/detail`
调用例子:
**调用例子:**
`/playlist/detail?id=24381616`
返回数据如下图:
![
歌单详情
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%AD%8C%E5%8D%95%E8%AF%A6%E6%83%85.png
)
### 获取音乐 url
说明:使用歌单详情接口后,能得到的音乐的 id, 但不能得到的音乐 url, 调用此接口,传入的音乐 id,可以获取对应的音乐的 url(不需要登录)
接口地址:
**必选参数:**
`id`
: 音乐 id
**接口地址:**
`playlist/detail`
调用例子:
**调用例子:**
`/playlist/detail?id=24381616`
返回数据如下图:
![
音乐 url
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E9%9F%B3%E4%B9%90%20url.png
)
### 搜索音乐
说明:调用此接口,传入搜索关键词可以搜索该音乐,关键词可以多个,以空格隔开,如"周杰伦 搁浅"(不需要登录)
必选参数:
keywords : 关键词
可选参数:
limit: 返回数量,默认为30
type: 搜索类型;默认为1,取值意义:
**必选参数:**
`keywords`
: 关键词
**可选参数:**
`limit`
: 返回数量,默认为30
`type`
: 搜索类型;默认为1,取值意义:
1: 单曲
10: 专辑
100: 歌手
1000: 歌单
1002: 用户
offset
: 偏移数量,用于分页
`offset`
: 偏移数量,用于分页
接口地址:
**接口地址:**
`/search`
调用例子:
**调用例子:**
`/search?keywords=海阔天空`
返回数据如下图:
![
搜索音乐
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%90%9C%E7%B4%A2.png
)
### 获取歌词
说明:调用此接口,传入音乐 id 可获得对应音乐的歌词(不需要登录)
接口地址:
**必选参数:**
`id`
: 音乐 id
**接口地址:**
`/lyric`
调用例子:
**调用例子:**
`/lyric?id=347230`
返回数据如下图:
![
搜索音乐
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%AD%8C%E8%AF%8D.png
)
### 获取评论
说明:调用此接口,传入歌音乐 id和 limit 参数, 可获得该音乐的所有评论(不需要登录)
**必选参数:**
`id`
: 音乐 id
**可选参数:**
`limit`
: 取出评论数量,默认为20
**接口地址:**
`/comment`
**调用例子:**
`/comment?id=186016&limit=1`
返回数据如下图:
![
获取评论
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/comment.png
)
### 获取歌手专辑列表
说明:调用此接口,传入歌手 id,可获得歌手专辑列表
接口地址:
**必选参数:**
`id`
: 歌手 id
**接口地址:**
`/album`
调用例子:
**调用例子:**
`album?id=32311`
返回数据如下图:
![
获取专辑
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E4%B8%93%E8%BE%91.png
)
...
...
@@ -112,19 +180,25 @@ type: 搜索类型;默认为1,取值意义:
### 获取每日推荐歌单
说明:调用此接口,可获得每日推荐歌单(需要登录)
接口地址:
**接口地址:**
`/recommend/resource`
调用例子:
**调用例子:**
`/recommend/resource`
返回数据如下图:
![
搜索音乐
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%8E%A8%E8%8D%90%E6%AD%8C%E5%8D%95.png
)
### 获取每日推荐歌曲
说明:调用此接口,可获得每日推荐歌曲(需要登录)
接口地址:
**接口地址:**
`/recommend/songs`
调用例子:
**调用例子:**
`/recommend/songs`
返回数据如下图:
![
搜索音乐
](
https://raw.githubusercontent.com/Binaryify/NeteaseCloudMusicApi/master/static/%E6%8E%A8%E8%8D%90%E6%AD%8C%E6%9B%B2.png
)
...
...
package.json
浏览文件 @
77f848b7
{
"name"
:
"NeteaseCloudMusicApi"
,
"version"
:
"2.
0.3
"
,
"version"
:
"2.
1.0
"
,
"description"
:
""
,
"scripts"
:
{
"start"
:
"node app.js"
,
...
...
@@ -8,7 +8,7 @@
},
"keywords"
:
[],
"author"
:
""
,
"license"
:
"
ISC
"
,
"license"
:
"
MIT
"
,
"dependencies"
:
{
"
big-integer
"
:
"
^1.6.17
"
,
"
express
"
:
"
^4.15.2
"
...
...
router/comment.js
0 → 100644
浏览文件 @
77f848b7
const
express
=
require
(
"
express
"
)
const
router
=
express
()
const
{
createWebAPIRequest
}
=
require
(
"
../util/util
"
)
router
.
get
(
"
/
"
,
(
req
,
res
)
=>
{
const
rid
=
req
.
query
.
id
const
cookie
=
req
.
get
(
'
Cookie
'
)
?
req
.
get
(
'
Cookie
'
)
:
''
const
data
=
{
"
offset
"
:
0
,
"
rid
"
:
rid
,
"
limit
"
:
req
.
query
.
limit
||
20
,
"
csrf_token
"
:
""
}
createWebAPIRequest
(
'
music.163.com
'
,
`/weapi/v1/resource/comments/R_SO_4_
${
rid
}
/?csrf_token=`
,
'
POST
'
,
data
,
cookie
,
music_req
=>
res
.
send
(
music_req
),
err
=>
res
.
status
(
502
).
send
(
'
fetch error
'
)
)
})
module
.
exports
=
router
\ No newline at end of file
test/comment.test.js
0 → 100644
浏览文件 @
77f848b7
const
assert
=
require
(
'
assert
'
)
const
crypto
=
require
(
'
crypto
'
)
const
{
createWebAPIRequest
}
=
require
(
"
../util/util
"
)
describe
(
'
测试获取评论是否正常
'
,
()
=>
{
it
(
'
数据的 code 应该为200
'
,
done
=>
{
const
rid
=
32311
const
cookie
=
''
const
data
=
{
"
offset
"
:
0
,
"
rid
"
:
rid
,
"
limit
"
:
20
,
"
csrf_token
"
:
""
}
createWebAPIRequest
(
'
music.163.com
'
,
`/weapi/v1/resource/comments/R_SO_4_
${
rid
}
/?csrf_token=`
,
'
POST
'
,
data
,
cookie
,
music_req
=>
{
console
.
log
({
code
:
JSON
.
parse
(
music_req
).
code
})
assert
(
JSON
.
parse
(
music_req
).
code
===
200
)
done
()
},
err
=>
done
(
err
)
)
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录