From f268e7b87068de238e6e9e5cd9fcf48e0be15aa5 Mon Sep 17 00:00:00 2001 From: Kengwang Date: Mon, 16 Jan 2023 00:22:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[feat]:=20=E4=B8=80?= =?UTF-8?q?=E8=B5=B7=E5=90=AC=20API=20=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 见 #1676 --- module/listentogether_end.js | 20 +++++++++++ module/listentogether_heatbeat.js | 23 +++++++++++++ module/listentogether_play_command.js | 28 ++++++++++++++++ module/listentogether_room_check.js | 20 +++++++++++ module/listentogether_room_create.js | 20 +++++++++++ ...her_status.js => listentogether_status.js} | 0 module/listentogether_sync_list_command.js | 33 +++++++++++++++++++ module/listentogether_sync_playlist_get.js | 20 +++++++++++ 8 files changed, 164 insertions(+) create mode 100644 module/listentogether_end.js create mode 100644 module/listentogether_heatbeat.js create mode 100644 module/listentogether_play_command.js create mode 100644 module/listentogether_room_check.js create mode 100644 module/listentogether_room_create.js rename module/{listen_together_status.js => listentogether_status.js} (100%) create mode 100644 module/listentogether_sync_list_command.js create mode 100644 module/listentogether_sync_playlist_get.js diff --git a/module/listentogether_end.js b/module/listentogether_end.js new file mode 100644 index 0000000..c4611b6 --- /dev/null +++ b/module/listentogether_end.js @@ -0,0 +1,20 @@ +// 一起听 结束房间 + +module.exports = (query, request) => { + const data = { + roomId: query.roomId + } + return request( + 'POST', + `http://interface.music.163.com/eapi/listen/together/end/v2`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/listen/together/end/v2' + }, + ) + } + \ No newline at end of file diff --git a/module/listentogether_heatbeat.js b/module/listentogether_heatbeat.js new file mode 100644 index 0000000..3e21da9 --- /dev/null +++ b/module/listentogether_heatbeat.js @@ -0,0 +1,23 @@ +// 一起听 发送心跳 + +module.exports = (query, request) => { + const data = { + roomId: query.roomId, + songId: query.songId, + playStatus: query.playStatus, + progress: query.progress + } + return request( + 'POST', + `http://interface.music.163.com/eapi/listen/together/heartbeat`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/listen/together/heartbeat' + }, + ) + } + \ No newline at end of file diff --git a/module/listentogether_play_command.js b/module/listentogether_play_command.js new file mode 100644 index 0000000..5b20d4b --- /dev/null +++ b/module/listentogether_play_command.js @@ -0,0 +1,28 @@ +// 一起听 发送播放状态 + +module.exports = (query, request) => { + const data = { + roomId: query.roomId, + commandInfo: { + commandType: query.commandType, + progress: query.progress || 0, + playStatus: query.playStatus, + formerSongId: query.formerSongId, + targetSongId: query.targetSongId, + clientSeq: query.clientSeq + } + } + return request( + 'POST', + `http://interface.music.163.com/eapi/listen/together/play/command/report`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/listen/together/play/command/report' + }, + ) + } + \ No newline at end of file diff --git a/module/listentogether_room_check.js b/module/listentogether_room_check.js new file mode 100644 index 0000000..4780529 --- /dev/null +++ b/module/listentogether_room_check.js @@ -0,0 +1,20 @@ +// 一起听 房间情况 + +module.exports = (query, request) => { + const data = { + roomId: query.roomId + } + return request( + 'POST', + `http://interface.music.163.com/eapi/listen/together/room/check`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/listen/together/room/check' + }, + ) + } + \ No newline at end of file diff --git a/module/listentogether_room_create.js b/module/listentogether_room_create.js new file mode 100644 index 0000000..7f25325 --- /dev/null +++ b/module/listentogether_room_create.js @@ -0,0 +1,20 @@ +// 一起听创建房间 + +module.exports = (query, request) => { + const data = { + refer: 'songplay_more' + } + return request( + 'POST', + `http://interface.music.163.com/eapi/listen/together/room/create`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/listen/together/room/create' + }, + ) + } + \ No newline at end of file diff --git a/module/listen_together_status.js b/module/listentogether_status.js similarity index 100% rename from module/listen_together_status.js rename to module/listentogether_status.js diff --git a/module/listentogether_sync_list_command.js b/module/listentogether_sync_list_command.js new file mode 100644 index 0000000..e2d9bb6 --- /dev/null +++ b/module/listentogether_sync_list_command.js @@ -0,0 +1,33 @@ +// 一起听 更新播放列表 + +module.exports = (query, request) => { + const data = { + roomId: query.roomId, + playlistParam: JSON.stringify({ + commandType: query.commandType, + version: [ + { + userId: query.userId, + version: query.version + } + ], + anchorSongId: '', + anchorPosition: -1, + randomList: query.randomList.split(','), + displayList: query.displayList.split(',') + }) + } + return request( + 'POST', + `http://interface.music.163.com/eapi/listen/together/sync/list/command/report`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/listen/together/sync/list/command/report' + }, + ) + } + \ No newline at end of file diff --git a/module/listentogether_sync_playlist_get.js b/module/listentogether_sync_playlist_get.js new file mode 100644 index 0000000..1485910 --- /dev/null +++ b/module/listentogether_sync_playlist_get.js @@ -0,0 +1,20 @@ +// 一起听 当前列表获取 + +module.exports = (query, request) => { + const data = { + roomId: query.roomId + } + return request( + 'POST', + `http://interface.music.163.com/eapi/listen/together/sync/playlist/get`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/listen/together/sync/playlist/get' + }, + ) + } + \ No newline at end of file From 51e1e3b6f9654c780f086f2f99ad8d2548d77778 Mon Sep 17 00:00:00 2001 From: Kengwang Date: Mon, 16 Jan 2023 00:48:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[doc]=20=E4=BF=AE=E6=94=B9=E4=B8=80?= =?UTF-8?q?=E8=B5=B7=E5=90=AC=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/README.md b/docs/README.md index cf9b2d0..e24fcf4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3557,13 +3557,9 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` **调用例子 :** `/artist/new/mv?limit=1` `/artist/new/mv?limit=1&before=1602777625000` -### 一起听状态 +### 一起听相关 -说明 :登录后调用此接口可获取一起听状态 - -**接口地址 :** `/listen/together/status` - -**调用例子 :** `/listen/together/status` +一起听相关参见此 Issue: [#1676](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1676) ### batch 批量请求接口 From 6a6c6e3dea143801817c2414f2a6e42830889c98 Mon Sep 17 00:00:00 2001 From: kengwang Date: Mon, 16 Jan 2023 15:23:44 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[fix/doc]=20=E5=AE=8C=E5=96=84=E4=B8=80?= =?UTF-8?q?=E8=B5=B7=E5=90=AC=20=E4=B8=BB=E6=9C=BA=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 8 + module/listentogether_play_command.js | 55 +++--- public/listen_together_host.html | 242 ++++++++++++++++++++++++++ 3 files changed, 277 insertions(+), 28 deletions(-) create mode 100644 public/listen_together_host.html diff --git a/docs/README.md b/docs/README.md index e24fcf4..0192516 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3561,6 +3561,14 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009` 一起听相关参见此 Issue: [#1676](https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1676) +主机模式: + +代码可参考: https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/public/listen_together_host.html + +访问地址: http://localhost:3000/listen_together_host.html + +从机模式: 待整理 + ### batch 批量请求接口 说明 : 登录后调用此接口 ,传入接口和对应原始参数(原始参数非文档里写的参数,需参考源码),可批量请求接口 diff --git a/module/listentogether_play_command.js b/module/listentogether_play_command.js index 5b20d4b..e236af4 100644 --- a/module/listentogether_play_command.js +++ b/module/listentogether_play_command.js @@ -1,28 +1,27 @@ -// 一起听 发送播放状态 - -module.exports = (query, request) => { - const data = { - roomId: query.roomId, - commandInfo: { - commandType: query.commandType, - progress: query.progress || 0, - playStatus: query.playStatus, - formerSongId: query.formerSongId, - targetSongId: query.targetSongId, - clientSeq: query.clientSeq - } - } - return request( - 'POST', - `http://interface.music.163.com/eapi/listen/together/play/command/report`, - data, - { - crypto: 'eapi', - cookie: query.cookie, - proxy: query.proxy, - realIP: query.realIP, - url: '/api/listen/together/play/command/report' - }, - ) - } - \ No newline at end of file +// 一起听 发送播放状态 + +module.exports = (query, request) => { + const data = { + roomId: query.roomId, + commandInfo: JSON.stringify({ + commandType: query.commandType, + progress: query.progress || 0, + playStatus: query.playStatus, + formerSongId: query.formerSongId, + targetSongId: query.targetSongId, + clientSeq: query.clientSeq, + }), + } + return request( + 'POST', + `http://interface.music.163.com/eapi/listen/together/play/command/report`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/listen/together/play/command/report', + }, + ) +} diff --git a/public/listen_together_host.html b/public/listen_together_host.html new file mode 100644 index 0000000..4c40a11 --- /dev/null +++ b/public/listen_together_host.html @@ -0,0 +1,242 @@ + + + + + + + + 一起听 - 主机模式 + + + + + + + +

一起听 - 主机模式

+
消息: {{message}}
+ +
+
+ +
您的当前登录账号为: {{account.nickname}}
+
+
+ + +
+
分享链接为: + https://st.music.163.com/listen-together/share/?songId=1372188635&roomId={{roomInfo.roomId}}&inviterId={{account.userId}} +
+
+ +
在线用户:
+
    +
  • +
    + +
    +
    {{user.nickname}}
    +
  • +
+ +
+
+ + + +
+ 播放列表 +
+
歌单ID:
+ + {{playlistInfo.playlistName}} +
+
+
歌单内容:
+
    +
  • +
    + +
    +
    {{track.name}}
    +
  • +
+
+ + + + +