Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
添加私信音乐接口 #1016,添加最近联系人接口,修复用户动态数量不准确问题 #1010,修复 cloudsearch 接口分页问题 #1015
Browse files Browse the repository at this point in the history
  • Loading branch information
Binaryify committed Nov 7, 2020
1 parent 65e32ee commit 0e1c7ee
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 24 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# 更新日志
### 3.46.0 | 2020.11.7
- 添加私信音乐接口 [#1016](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1016)

- 添加最近联系人接口

- 修复用户动态数量不准确问题 [#1010](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1010)

- 修复 cloudsearch 接口分页问题 [#1015](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1015)

### 3.45.3 | 2020.11.1
- `相似歌手`,`首页-发现-圆形图标入口列表`接口增加匿名token[#877](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/877) [#988](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/988)

Expand Down
2 changes: 2 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ banner({ type:0 }).then(res=>{
187. 云贝支出
188. 云贝账户信息
189. 账号信息
190. 最近联系人
191. 私信音乐

## 更新日志

Expand Down
42 changes: 32 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@
187. 云贝支出
188. 云贝账户信息
189. 账号信息
190. 最近联系人
191. 私信音乐

## 安装

Expand Down Expand Up @@ -2771,23 +2773,20 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009`

**调用例子 :** `/send/text?user_ids=32953014&msg=test`,`/send/text?user_ids=32953014,475625142&msg=test`

### 发送私信音乐

### 私信内容
说明 : 登录后调用此接口 , 可获取私信内容
说明 : 登录后调用此接口 , 传入用户 id 和要发送的信息,音乐id, 可以发送音乐私信,返回内容为历史私信

**必选参数 :**
`uid` : 用户 id

**可选参数 :**
`limit` : 返回数量 , 默认为 30
`user_ids` : 用户 id,多个需用逗号隔开

`before` : 分页参数,取上一页最后一项的 `time` 获取下一页数据
`msg` : 要发送的信息

**接口地址 :**
`/msg/private/history`
**接口地址 :** `/send/song`

**调用例子 :** `/send/song?user_ids=1&id=351318&msg=测试`

**调用例子 :**
`/msg/private/history?uid=9003` (云音乐小秘书)

### 发送私信(带歌单)

Expand All @@ -2803,6 +2802,29 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009`

**调用例子 :** `/send/playlist?msg=test&user_ids=475625142&playlist=705123491`,`/send/playlist?msg=test2&user_ids=475625142,32953014&playlist=705123493`

### 最近联系人
说明 : 登录后调用此接口 ,可获取最接近联系人

**接口地址 :** `/msg/recentcontact`

**调用例子 :** `/msg/recentcontact`

### 私信内容
说明 : 登录后调用此接口 , 可获取私信内容

**必选参数 :**
`uid` : 用户 id

**可选参数 :**
`limit` : 返回数量 , 默认为 30

`before` : 分页参数,取上一页最后一项的 `time` 获取下一页数据

**接口地址 :**
`/msg/private/history`

**调用例子 :**
`/msg/private/history?uid=9003` (云音乐小秘书)

### 通知 - 评论

Expand Down
18 changes: 7 additions & 11 deletions module/cloudsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ module.exports = (query, request) => {
type: query.type || 1, // 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频
limit: query.limit || 30,
offset: query.offset || 0,
total: true,
}
return request(
'POST',
`https://music.163.com/weapi/cloudsearch/get/web`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
return request('POST', `https://music.163.com/api/cloudsearch/pc`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
})
}
16 changes: 16 additions & 0 deletions module/msg_recentcontact.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 最近联系

module.exports = (query, request) => {
const data = {}
return request(
'POST',
`https://music.163.com/api/msg/recentcontact/get`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
17 changes: 17 additions & 0 deletions module/send_song.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 私信歌曲

module.exports = (query, request) => {
// query.cookie.os = 'pc'
const data = {
id: query.id,
msg: query.msg || '',
type: 'song',
userIds: '[' + query.user_ids + ']',
}
return request('POST', `https://music.163.com/api/msg/private/send`, data, {
crypto: 'api',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
})
}
6 changes: 4 additions & 2 deletions module/user_event.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// 用户动态

module.exports = (query, request) => {
query.cookie.os = 'ios'
query.cookie.appver = '7.3.27'
const data = {
getcounts: true,
time: query.lasttime || -1,
Expand All @@ -9,10 +11,10 @@ module.exports = (query, request) => {
}
return request(
'POST',
`https://music.163.com/weapi/event/get/${query.uid}`,
`https://music.163.com/api/event/get/${query.uid}`,
data,
{
crypto: 'weapi',
crypto: 'api',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NeteaseCloudMusicApi",
"version": "3.45.3",
"version": "3.46.0",
"description": "网易云音乐 NodeJS 版 API",
"scripts": {
"start": "node app.js",
Expand Down

1 comment on commit 0e1c7ee

@vercel
Copy link

@vercel vercel bot commented on 0e1c7ee Nov 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.