@neteasecloudmusicapienhanced/api 4.29.19 → 4.29.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.MD CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 项目简介
6
6
 
7
- 本项目为网易云音乐第三方 Node.js API,基于社区停更的原版 API 持续维护和升级,支持丰富的音乐相关接口,适合自建服务、二次开发和多平台部署(如果原版诈尸, 我会及时同步 or 归档)。
7
+ 本项目为网易云音乐第三方 Node.js API,基于停更的原版 API 持续维护,支持丰富的音乐相关接口,适合自建服务、二次开发和多平台部署(如果原版诈尸, 我会及时同步 or 归档)。
8
8
 
9
9
  ## 快速开始
10
10
 
@@ -77,7 +77,7 @@ docker run -d \
77
77
 
78
78
  运行后访问 http://localhost:3000 即可使用 API。
79
79
 
80
- ### 3. 环境变量
80
+ ## 3. 环境变量
81
81
 
82
82
  | 变量名 | 默认值 | 说明 |
83
83
  | -------------------------- | ------------------------------------ | ------------------------------------------------------------------------------ |
@@ -87,7 +87,6 @@ docker run -d \
87
87
  | **ENABLE_GENERAL_UNBLOCK** | `true` | 是否启用全局解灰(推荐开启)。开启后所有歌曲都尝试自动解锁。 |
88
88
  | **ENABLE_FLAC** | `true` | 是否启用无损音质(FLAC)。 |
89
89
  | **SELECT_MAX_BR** | `false` | 启用无损音质时,是否选择最高码率音质。 |
90
- | **UNBLOCK_SOURCE** | `pyncmd,qq,bodian,migu,kugou,kuwo` | 音源优先级列表(多个音源以逗号分隔)。 |
91
90
  | **FOLLOW_SOURCE_ORDER** | `true` | 是否严格按照音源列表顺序进行匹配。 |
92
91
 
93
92
  ---
@@ -157,15 +156,27 @@ pnpm test
157
156
  - 用户信息、歌单、动态、播放记录
158
157
  - 歌曲、专辑、歌手、MV、歌词、评论、排行榜
159
158
  - 搜索、推荐、私人 FM、签到、云盘
160
- - 歌曲解锁(解灰)、多音源支持(qq/bodian/kuwo/kugou/migu/pyncmd)
161
- > 注意: 如果解灰出现问题, 本项目只是集成[UnblockNeteaseMusic](https://github.com/UnblockNeteaseMusic/server)的接口, 请在对应的仓库开启议题
162
- - 详细接口请见[在线文档](https://neteasecloudmusicapienhanced.js.org/)
159
+ - 歌曲解锁(解灰)
163
160
 
164
161
  ## 贡献与社区
165
162
 
166
163
  - 欢迎提交 PR、Issue 参与维护
167
164
 
168
- ## SDK 生态
165
+ ### 致谢
166
+
167
+ 原作者 [Binaryify/NeteaseCloudMusicApi](https://github.com/binaryify/NeteaseCloudMusicApi) 项目为本项目基础 (该项目在`npmjs`网站上仍持续维护, 但 github 仓库已不再更新)
168
+
169
+ 感谢大佬们为逆向eapi, weapi等加密算法所做的贡献
170
+
171
+ 项目参考:
172
+
173
+ [trazyn/ieaseMusic](https://github.com/trazyn/ieaseMusic)
174
+
175
+ [listen1/listen1_chrome_extension](https://github.com/listen1/listen1_chrome_extension)
176
+
177
+ [chaunsin/netease-cloud-music](https://github.com/chaunsin/netease-cloud-music)
178
+
179
+ ### SDK 生态
169
180
 
170
181
  | 语言 | 作者 | 地址 | 类型 |
171
182
  | ------ | ------------------------------------------- | ---------------------------------------------------------------------------------------- | ------ |
@@ -173,6 +184,13 @@ pnpm test
173
184
  | Java | [1015770492](https://github.com/1015770492) | https://github.com/1015770492/yumbo-music-utils | 第三方 |
174
185
  | Python | [盧瞳](https://github.com/2061360308) | [NeteaseCloudMusic_PythonSDK](https://github.com/2061360308/NeteaseCloudMusic_PythonSDK) | 第三方 |
175
186
 
187
+
188
+ ### 依赖此项目的优秀开源项目
189
+
190
+ - [imsyy/splayer](https://github.com/imsyy/splayer)
191
+
192
+ - [qier2222/YesPlayMusic](https://github.com/qier222/YesPlayMusic)
193
+
176
194
  ## License
177
195
 
178
196
  [MIT License](https://github.com/MoeFurina/NeteaseCloudMusicApiEnhanced/blob/main/LICENSE)
@@ -6,23 +6,23 @@ const logger = require('../util/logger.js')
6
6
 
7
7
  module.exports = async (query, request) => {
8
8
  try {
9
- const match = require('@unblockneteasemusic/server')
10
- const source = query.source
11
- ? query.source.split(',')
12
- : ['pyncmd', 'bodian', 'kuwo', 'qq', 'migu', 'kugou']
13
- const server = query.server ? query.server.split(',') : query.server
14
- const result = await match(query.id, !server ? source : server)
9
+ const {
10
+ matchID,
11
+ } = require('@neteasecloudmusicapienhanced/unblockmusic-utils')
12
+ const result = await matchID(query.id, query.source)
15
13
  const proxy = process.env.PROXY_URL
16
14
  logger.info('开始解灰', query.id, result)
17
15
  const useProxy = process.env.ENABLE_PROXY || 'false'
18
- if (result.url.includes('kuwo')) {
19
- result.proxyUrl = useProxy === 'true' ? proxy + result.url : result.url
16
+ if (result.data.url && result.data.url.includes('kuwo')) {
17
+ result.proxyUrl =
18
+ useProxy === 'true' ? proxy + result.data.url : result.data.url
20
19
  }
21
20
  return {
22
21
  status: 200,
23
22
  body: {
24
23
  code: 200,
25
- data: result,
24
+ data: result.data.url,
25
+ proxyUrl: result.proxyUrl || '',
26
26
  },
27
27
  }
28
28
  } catch (e) {
@@ -1,13 +1,14 @@
1
1
  // 歌曲链接 - v1
2
2
  // 此版本不再采用 br 作为音质区分的标准
3
3
  // 而是采用 standard, exhigh, lossless, hires, jyeffect(高清环绕声), sky(沉浸环绕声), jymaster(超清母带) 进行音质判断
4
- // 当unblock为true时, 会尝试使用unblockneteasemusic进行解锁, 同时音质设置不会生效, 但仍然为必须传入参数
4
+ // 当unblock为true时, 会尝试使用unblockmusic-utils进行解锁, 同时音质设置不会生效, 但仍然为必须传入参数
5
5
 
6
6
  const logger = require('../util/logger.js')
7
7
  const createOption = require('../util/option.js')
8
8
  module.exports = async (query, request) => {
9
- const match = require('@unblockneteasemusic/server')
10
- const source = ['pyncmd', 'bodian', 'kuwo', 'qq', 'migu', 'kugou']
9
+ const {
10
+ matchID,
11
+ } = require('@neteasecloudmusicapienhanced/unblockmusic-utils')
11
12
  require('dotenv').config()
12
13
  const data = {
13
14
  ids: '[' + query.id + ']',
@@ -16,48 +17,37 @@ module.exports = async (query, request) => {
16
17
  }
17
18
  if (query.unblock === 'true') {
18
19
  try {
19
- const result = await match(query.id, source)
20
+ const result = await matchID(query.id, query.source)
20
21
  logger.info('Starting unblock(uses modules unblock):', query.id, result)
21
- // avoid optional chaining for compatibility
22
- let url
23
- if (Array.isArray(result)) {
24
- url = result[0] && result[0].url ? result[0].url : result[0]
25
- } else {
26
- url = result && result.url ? result.url : result
27
- }
28
- // decide proxyUrl after we resolved the actual url value
22
+ const useProxy = process.env.ENABLE_PROXY || 'false'
29
23
  let proxyUrl = ''
30
- if (url) {
31
- if (url.includes('kuwo')) {
32
- const useProxy = process.env.ENABLE_PROXY || 'false'
33
- if (useProxy === 'true' && process.env.PROXY_URL) {
34
- proxyUrl = process.env.PROXY_URL + url
35
- } else {
36
- proxyUrl = url
37
- }
38
- }
39
- return {
40
- status: 200,
41
- body: {
42
- code: 200,
43
- msg: 'Warning: you can only adjust unblock source in dotenv config, use /song/url/match instead.',
44
- data: [
45
- {
46
- id: Number(query.id),
47
- url,
48
- type: 'flac',
49
- level: query.level,
50
- freeTrialInfo: 'null',
51
- fee: 0,
52
- proxyUrl: proxyUrl || '',
53
- },
54
- ],
55
- },
56
- cookie: [],
57
- }
24
+ if (result.data.url && result.data.url.includes('kuwo')) {
25
+ proxyUrl =
26
+ useProxy === 'true' && process.env.PROXY_URL
27
+ ? process.env.PROXY_URL + result.data.url
28
+ : result.data.url
29
+ }
30
+ return {
31
+ status: 200,
32
+ body: {
33
+ code: 200,
34
+ msg: 'Warning: Customizing unblock sources is not supported on this endpoint. Please use `/song/url/match` instead.',
35
+ data: [
36
+ {
37
+ id: Number(query.id),
38
+ url: result.data.url,
39
+ type: 'flac',
40
+ level: query.level,
41
+ freeTrialInfo: 'null',
42
+ fee: 0,
43
+ proxyUrl: proxyUrl || '',
44
+ },
45
+ ],
46
+ },
47
+ cookie: [],
58
48
  }
59
49
  } catch (e) {
60
- console.error('Error in unblockneteasemusic:', e)
50
+ console.error('Error in unblocking music:', e)
61
51
  }
62
52
  }
63
53
  if (data.level == 'sky') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neteasecloudmusicapienhanced/api",
3
- "version": "4.29.19",
3
+ "version": "4.29.20",
4
4
  "description": "A revival project for NeteaseCloudMusicApi Node.js Services (Half Refactor & Enhanced)|| 网易云音乐 API 备份 + 增强 || 本项目自原版v4.28.0版本后开始自行维护",
5
5
  "scripts": {
6
6
  "dev": "nodemon app.js",
@@ -66,7 +66,7 @@
66
66
  "data"
67
67
  ],
68
68
  "dependencies": {
69
- "@unblockneteasemusic/server": "^0.28.0",
69
+ "@neteasecloudmusicapienhanced/unblockmusic-utils": "^0.1.3",
70
70
  "axios": "^1.13.2",
71
71
  "crypto-js": "^4.2.0",
72
72
  "dotenv": "^17.2.3",
@@ -1244,7 +1244,7 @@ tags: 歌单标签
1244
1244
  **必选参数 :** `id` : 音乐 id
1245
1245
  `level`: 播放音质等级, 分为 `standard` => `标准`,`higher` => `较高`, `exhigh`=>`极高`,
1246
1246
  `lossless`=>`无损`, `hires`=>`Hi-Res`, `jyeffect` => `高清环绕声`, `sky` => `沉浸环绕声`, `dolby` => `杜比全景声`, `jymaster` => `超清母带`
1247
- `unblock`: 是否使用`UnblockNeteaseMusic`, 分为`true`和`false`
1247
+ `unblock`: 是否使用使用歌曲解锁, 分为`true`和`false`
1248
1248
 
1249
1249
  **接口地址 :** `/song/url/v1`
1250
1250
 
@@ -1252,8 +1252,6 @@ tags: 歌单标签
1252
1252
 
1253
1253
  说明:`杜比全景声`音质需要设备支持,不同的设备可能会返回不同码率的 url。cookie 需要传入`os=pc`保证返回正常码率的 url。
1254
1254
 
1255
- 注意: 如果解灰出现问题, 本项目只是集成[UnblockNeteaseMusic](https://github.com/UnblockNeteaseMusic/server)的接口, 请在对应的仓库开启议题
1256
-
1257
1255
  ### 音乐是否可用
1258
1256
 
1259
1257
  说明: 调用此接口,传入歌曲 id, 可获取音乐是否可用,返回 `{ success: true, message: 'ok' }` 或者 `{ success: false, message: '亲爱的,暂无版权' }`
@@ -1268,17 +1266,15 @@ tags: 歌单标签
1268
1266
 
1269
1267
  ### 直接获取灰色歌曲链接
1270
1268
 
1271
- 说明 : 技术来自于 [UnblockNeteaseMusic](https://github.com/unblockneteasemusic/server) 的支持, 聚合多个音源匹配(有几率匹配不成功)
1269
+ 说明 : 技术部分来自于 [UnblockNeteaseMusic](https://github.com/unblockneteasemusic/server) 的支持
1272
1270
 
1273
1271
  **必选参数 :** `id` : 音乐 id
1274
1272
 
1275
- **可选参数 :** `source`: 选择要解灰的音源, 目前支持`pyncmd`, `bodian`, `kuwo`, `kugou`, `qq`, `migu`, 选择多个音源中间用`,`分隔
1273
+ **可选参数 :** `source`: 选择要解灰的音源, 不支持多音源
1276
1274
 
1277
1275
  **接口地址 :** `/song/url/match`
1278
1276
 
1279
- **调用例子 :** `/song/url/match?id=1969519579` `/song/url/match?id=1969519579&source=pyncmd,bodian`
1280
-
1281
- 注意: 如果解灰出现问题, 本项目只是集成[UnblockNeteaseMusic](https://github.com/UnblockNeteaseMusic/server)的接口, 请在对应的仓库开启议题
1277
+ **调用例子 :** `/song/url/match?id=1969519579` `/song/url/match?id=1969519579`
1282
1278
 
1283
1279
  ### 搜索
1284
1280
 
@@ -58,33 +58,8 @@
58
58
  <input type="number" id="songId" placeholder="请输入音乐ID" required>
59
59
  </div>
60
60
  <div class="form-group">
61
- <p>选择音源:</p>
62
- <div class="source-options">
63
- <div class="source-option">
64
- <input type="checkbox" id="pyncmd" value="pyncmd">
65
- <label for="pyncmd">pyncmd</label>
66
- </div>
67
- <div class="source-option">
68
- <input type="checkbox" id="kuwo" value="kuwo">
69
- <label for="kuwo">kuwo</label>
70
- </div>
71
- <div class="source-option">
72
- <input type="checkbox" id="bodian" value="bodian">
73
- <label for="bodian">bodian</label>
74
- </div>
75
- <div class="source-option">
76
- <input type="checkbox" id="qq" value="qq">
77
- <label for="qq">qq</label>
78
- </div>
79
- <div class="source-option">
80
- <input type="checkbox" id="kugou" value="kugou">
81
- <label for="kugou">kugou</label>
82
- </div>
83
- <div class="source-option">
84
- <input type="checkbox" id="migu" value="migu">
85
- <label for="migu">migu</label>
86
- </div>
87
- </div>
61
+ <label for="sources">音源列表:</label>
62
+ <input type="text" id="sources" placeholder="请输入音源(非必填)">
88
63
  </div>
89
64
  <button onclick="testSong()">开始测试</button>
90
65
  <div id="result"></div>
@@ -98,14 +73,9 @@
98
73
  return;
99
74
  }
100
75
 
101
- const sources = ['pyncmd', 'kuwo', 'bodian', 'qq', 'kugou', 'migu']
102
- .filter(source => document.getElementById(source).checked)
103
- .join(',');
76
+ const sources = document.getElementById('sources').value;
77
+
104
78
 
105
- if (!sources) {
106
- alert('请至少选择一个音源');
107
- return;
108
- }
109
79
 
110
80
  const resultDiv = document.getElementById('result');
111
81
  resultDiv.textContent = '正在请求...';
package/server.js CHANGED
@@ -254,13 +254,12 @@ async function consturctServer(moduleDefs) {
254
254
  !song.url ||
255
255
  [1, 4].includes(song.fee)
256
256
  ) {
257
- const match = require('@unblockneteasemusic/server')
258
- const source = process.env.UNBLOCK_SOURCE
259
- ? process.env.UNBLOCK_SOURCE.split(',')
260
- : ['pyncmd', 'bodian', 'kuwo', 'qq', 'migu', 'kugou']
261
- logger.info('Starting unblock(uses general unblock):', source)
262
- const { url } = await match(req.query.id, source)
263
- song.url = url
257
+ const {
258
+ matchID,
259
+ } = require('@neteasecloudmusicapienhanced/unblockmusic-utils')
260
+ logger.info('Starting unblock(uses general unblock):', req.query.id)
261
+ const result = await matchID(req.query.id)
262
+ song.url = result.data.url
264
263
  song.freeTrialInfo = 'null'
265
264
  logger.info('Unblock success! url:', song.url)
266
265
  }