@neteasecloudmusicapienhanced/api 4.29.20 → 4.29.21

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
@@ -6,11 +6,20 @@
6
6
 
7
7
  本项目为网易云音乐第三方 Node.js API,基于停更的原版 API 持续维护,支持丰富的音乐相关接口,适合自建服务、二次开发和多平台部署(如果原版诈尸, 我会及时同步 or 归档)。
8
8
 
9
+ > [!IMPORTANT]
10
+ >
11
+ > ## 注意
12
+ >
13
+ > - 本项目是一个高度去中心化的第三方 API,其维护都由社区志愿者使用`Pull Request`完成。
14
+ > - 使用本项目时请务必遵守相关法律法规,遵守`MIT`协议, 尊重网易云音乐的服务条款。
15
+ > - 原作者项目 [Binaryify/NeteaseCloudMusicApi](https://github.com/binaryify/NeteaseCloudMusicApi) 并非完全停止维护, 你可以在 [NeteaseCloudMusicApi 的 NPMJS 页面](https://www.npmjs.com/package/NeteaseCloudMusicApi) 查看最新版本信息。
16
+ > - 感谢尊重和理解!
17
+
9
18
  ## 快速开始
10
19
 
11
20
  ### 环境要求
12
21
 
13
- - Node.js 14 及以上
22
+ - Node.js 18 及以上
14
23
  - 推荐使用 pnpm 进行依赖管理
15
24
 
16
25
  ### 安装
@@ -51,31 +60,43 @@ set PORT=4000 && node app.js # Windows
51
60
 
52
61
  本项目支持通过 Docker 一键部署,无需手动安装 Node.js 或依赖。
53
62
 
54
- ### 1. 拉取镜像
63
+ > 注意: 在 docker 中运行的时候, 由于使用了 request 来发请求, 所以会检查几个 proxy 相关的环境变量(如下所列), 这些环境变量 会影响到 request 的代理, 详情请参考[request 的文档](https://github.com/request/request#proxies), 如果这些环境变量 指向的代理不可用, 那么就会造成错误, 所以在使用 docker 的时候一定要注意这些环境变量. 不过, 要是你在 query 中加上了 proxy 参数, 那么环境变量会被覆盖, 就会用你通过 proxy 参数提供的代理了.
55
64
 
56
- Docker Hub 拉取最新版本镜像:
65
+ request 相关的环境变量
57
66
 
58
- ```bash
67
+ 1. http_proxy
68
+ 2. https_proxy
69
+ 3. HTTP_PROXY
70
+ 4. HTTPS_PROXY
71
+ 5. no_proxy
72
+ 6. NO_PROXY
73
+
74
+ ```shell
59
75
  docker pull moefurina/ncm-api:latest
60
- ```
61
76
 
62
- 或指定版本(与 package.json 中版本号一致):
77
+ docker run -d -p 3000:3000 --name ncm-api moefurina/ncm-api:latest
63
78
 
64
- ```bash
65
- docker pull moefurina/ncm-api:4.29.0
66
79
 
67
- ```
80
+ // 或者
81
+ docker run -d -p 3000:3000 moefurina/ncm-api:latest
68
82
 
69
- ### 2. 运行容器
83
+ // 去掉或者设置相关的环境变量
70
84
 
71
- ```bash
72
- docker run -d \
73
- --name ncm-api \
74
- -p 3000:3000 \
75
- moefurina/ncm-api:latest
85
+ docker run -d -p 3000:3000 --name ncm-api -e http_proxy= -e https_proxy= -e no_proxy= -e HTTP_PROXY= -e HTTPS_PROXY= -e NO_PROXY= moefurina/ncm-api:latest
86
+
87
+ // 或者
88
+ docker run -d -p 3000:3000 -e http_proxy= -e https_proxy= -e no_proxy= -e HTTP_PROXY= -e HTTPS_PROXY= -e NO_PROXY= moefurina/ncm-api:latest
76
89
  ```
77
90
 
78
- 运行后访问 http://localhost:3000 即可使用 API。
91
+ > 以下是自行 build docker 镜像方式
92
+
93
+ ```shell
94
+ $ git clone https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced && cd api-enhanced
95
+
96
+ $ sudo docker build . -t ncm-api
97
+
98
+ $ sudo docker run -d -p 3000:3000 ncm-api
99
+ ```
79
100
 
80
101
  ## 3. 环境变量
81
102
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@neteasecloudmusicapienhanced/api",
3
- "version": "4.29.20",
4
- "description": "A revival project for NeteaseCloudMusicApi Node.js Services (Half Refactor & Enhanced)|| 网易云音乐 API 备份 + 增强 || 本项目自原版v4.28.0版本后开始自行维护",
3
+ "version": "4.29.21",
4
+ "description": "全网最全的网易云音乐API接口 || A revival project for NeteaseCloudMusicApi Node.js Services (Half Refactor & Enhanced) || 网易云音乐 API 备份 + 增强 || 本项目自原版v4.28.0版本后开始自行维护",
5
5
  "scripts": {
6
6
  "dev": "nodemon app.js",
7
7
  "start": "node app.js",
@@ -67,13 +67,13 @@
67
67
  ],
68
68
  "dependencies": {
69
69
  "@neteasecloudmusicapienhanced/unblockmusic-utils": "^0.1.3",
70
- "axios": "^1.13.2",
70
+ "axios": "^1.13.4",
71
71
  "crypto-js": "^4.2.0",
72
72
  "dotenv": "^17.2.3",
73
73
  "express": "^5.2.1",
74
74
  "express-fileupload": "^1.5.2",
75
75
  "md5": "^2.3.0",
76
- "music-metadata": "^11.10.3",
76
+ "music-metadata": "^11.11.1",
77
77
  "node-forge": "^1.3.3",
78
78
  "pac-proxy-agent": "^7.2.0",
79
79
  "qrcode": "^1.5.4",
@@ -88,22 +88,22 @@
88
88
  "@types/express": "^5.0.6",
89
89
  "@types/express-fileupload": "^1.5.1",
90
90
  "@types/mocha": "^10.0.10",
91
- "@types/node": "24.10.0",
92
- "@typescript-eslint/eslint-plugin": "8.46.2",
93
- "@typescript-eslint/parser": "8.46.3",
91
+ "@types/node": "25.0.9",
92
+ "@typescript-eslint/eslint-plugin": "8.46.3",
93
+ "@typescript-eslint/parser": "8.53.0",
94
94
  "eslint": "9.39.0",
95
95
  "eslint-config-prettier": "10.1.8",
96
96
  "eslint-plugin-html": "8.1.3",
97
- "eslint-plugin-prettier": "5.5.4",
97
+ "eslint-plugin-prettier": "5.5.5",
98
98
  "globals": "^16.5.0",
99
99
  "husky": "9.1.7",
100
100
  "intelli-espower-loader": "1.1.0",
101
- "lint-staged": "16.2.6",
101
+ "lint-staged": "16.2.7",
102
102
  "mocha": "11.7.5",
103
103
  "nodemon": "^3.1.11",
104
104
  "pkg": "^5.8.1",
105
105
  "power-assert": "1.6.1",
106
- "prettier": "3.6.2",
106
+ "prettier": "3.7.4",
107
107
  "typescript": "5.9.3"
108
108
  }
109
109
  }
package/public/cloud.html CHANGED
@@ -20,7 +20,6 @@
20
20
  <script src="https://fastly.jsdelivr.net/npm/axios@0.26.1/dist/axios.min.js"></script>
21
21
  <script src="https://fastly.jsdelivr.net/npm/vue"></script>
22
22
  <script>
23
- const logger = require('../util/logger.js')
24
23
  const app = Vue.createApp({
25
24
  data() {
26
25
  return {
@@ -32,14 +31,14 @@
32
31
  },
33
32
  methods: {
34
33
  getData() {
35
- logger.info('getdata')
34
+ console.info('getdata')
36
35
  const _this = this
37
36
  axios({
38
37
  url: `/user/cloud?time=${Date.now()}&cookie=${localStorage.getItem(
39
38
  'cookie',
40
39
  )}`,
41
40
  }).then((res) => {
42
- logger.info(res.data)
41
+ console.info(res.data)
43
42
  _this.songs = res.data.data
44
43
  })
45
44
  },
@@ -52,7 +51,7 @@
52
51
  document
53
52
  .querySelector('input[type="file"]')
54
53
  .addEventListener('change', function (e) {
55
- logger.info(this.files)
54
+ console.info(this.files)
56
55
  let currentIndx = 0
57
56
  fileLength = this.files.length
58
57
  for (const item of this.files) {
@@ -77,15 +76,15 @@
77
76
  data: formData,
78
77
  })
79
78
  .then((res) => {
80
- logger.info(`${file.name} 上传成功`)
79
+ console.info(`${file.name} 上传成功`)
81
80
  if (currentIndx >= fileLength) {
82
- logger.info('上传完毕')
81
+ console.info('上传完毕')
83
82
  }
84
83
  app.getData()
85
84
  })
86
85
  .catch(async (err) => {
87
- logger.info(err)
88
- logger.info(fileUpdateTime)
86
+ console.info(err)
87
+ console.info(fileUpdateTime)
89
88
  fileUpdateTime[file.name]
90
89
  ? (fileUpdateTime[file.name] += 1)
91
90
  : (fileUpdateTime[file.name] = 1)
@@ -8,6 +8,19 @@
8
8
  <link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
9
9
  </head>
10
10
 
11
+ <style>
12
+ .decode-result {
13
+ white-space: pre-wrap;
14
+ word-break: break-all;
15
+ background-color: #f0f0f0;
16
+ padding: 10px;
17
+ border-radius: 5px;
18
+ margin-top: 10px;
19
+ height: 300px;
20
+ overflow: auto;
21
+ }
22
+ </style>
23
+
11
24
  <body>
12
25
  <div id="app" class="p-5 flex flex-col">
13
26
  <h1 class="text-2xl font-bold mb-5">eapi 参数和返回内容解析</h1>
@@ -23,7 +36,7 @@
23
36
  </div>
24
37
  <div>
25
38
  <p>解密结果:
26
- <pre>{{ JSON.stringify(JSON.parse(result), null, 2) }}</pre>
39
+ <pre class="decode-result">{{ JSON.stringify(JSON.parse(result), null, 2) }}</pre>
27
40
  </p>
28
41
  </div>
29
42
 
@@ -39,7 +52,6 @@
39
52
  <script src="https://fastly.jsdelivr.net/npm/vue@3"></script>
40
53
 
41
54
  <script>
42
- const logger = require('../util/logger.js')
43
55
  const app = Vue.createApp({
44
56
  data() {
45
57
  return {
@@ -62,7 +74,7 @@
62
74
  }
63
75
  })
64
76
  this.result = JSON.stringify(res.data.data)
65
- logger.info(res.data);
77
+ console.log(res.data);
66
78
  } catch (error) {
67
79
  console.error(error)
68
80
  alert(error?.response?.data?.message || '解密失败,数据格式错误')
@@ -74,4 +86,4 @@
74
86
  </script>
75
87
  </body>
76
88
 
77
- </html>
89
+ </html>
package/public/home.html CHANGED
@@ -12,7 +12,6 @@
12
12
  </div>
13
13
  <script src="https://fastly.jsdelivr.net/npm/axios@0.26.1/dist/axios.min.js"></script>
14
14
  <script>
15
- const logger = require('../util/logger.js')
16
15
  async function main() {
17
16
  const res = await axios({
18
17
  url: `/homepage/block/page`,
@@ -22,7 +21,7 @@
22
21
  method: 'post',
23
22
  })
24
23
  let cursor = ''
25
- logger.info(res.data.data)
24
+ console.info(res.data.data)
26
25
  if (res.data.data.hasMore) {
27
26
  cursor = res.data.data.cursor
28
27
  const res2 = await axios({
@@ -88,7 +88,6 @@
88
88
  </details>
89
89
  </body>
90
90
  <script>
91
- const logger = require('../util/logger.js')
92
91
  PetiteVue.createApp({
93
92
  message: '请点击获取登录状态',
94
93
  account: {
@@ -140,7 +139,7 @@
140
139
  cookie: localStorage.getItem('cookie'),
141
140
  },
142
141
  })
143
- logger.info(res)
142
+ console.info(res)
144
143
  if (res.data.code != 200) {
145
144
  this.message = '加入房间出现问题: ' + res.data.message
146
145
  } else {
@@ -153,7 +152,7 @@
153
152
  cookie: localStorage.getItem('cookie'),
154
153
  },
155
154
  })
156
- logger.info(res2)
155
+ console.info(res2)
157
156
  const res3 = await axios({
158
157
  url: 'listentogether/sync/playlist/get',
159
158
  method: 'post',
@@ -174,7 +173,7 @@
174
173
  cookie: localStorage.getItem('cookie'),
175
174
  },
176
175
  })
177
- logger.info(resa)
176
+ console.info(resa)
178
177
  this.playlistInfo.playlistTracks = resa.data.songs
179
178
  }
180
179
  },
@@ -186,7 +185,7 @@
186
185
  cookie: localStorage.getItem('cookie'),
187
186
  },
188
187
  })
189
- logger.info(res)
188
+ console.info(res)
190
189
  if (res.data.code != 200) {
191
190
  this.message = '创建房间出现问题: ' + res.data.message
192
191
  } else {
@@ -201,7 +200,7 @@
201
200
  cookie: localStorage.getItem('cookie'),
202
201
  },
203
202
  })
204
- logger.info(res2)
203
+ console.info(res2)
205
204
  }
206
205
  },
207
206
  refreshRoom: async function () {
@@ -211,7 +210,7 @@
211
210
  cookie: localStorage.getItem('cookie'),
212
211
  },
213
212
  })
214
- logger.info(res)
213
+ console.info(res)
215
214
  if (res.data.code != 200 || !res.data.data.inRoom) {
216
215
  this.message = '房间状态获取失败, 可能退出了房间'
217
216
  } else {
@@ -227,7 +226,7 @@
227
226
  cookie: localStorage.getItem('cookie'),
228
227
  },
229
228
  })
230
- logger.info(res)
229
+ console.info(res)
231
230
  if (res.data.code != 200 || !res.data.data.success) {
232
231
  this.message = '房间关闭失败'
233
232
  } else {
@@ -244,7 +243,7 @@
244
243
  cookie: localStorage.getItem('cookie'),
245
244
  },
246
245
  })
247
- logger.info(res)
246
+ console.info(res)
248
247
  this.playlistInfo.playlistName = res.data.playlist.name
249
248
  this.playlistInfo.playlistTrackIds = res.data.playlist.trackIds
250
249
  .map((track) => track.id)
@@ -257,7 +256,7 @@
257
256
  cookie: localStorage.getItem('cookie'),
258
257
  },
259
258
  })
260
- logger.info(resa)
259
+ console.info(resa)
261
260
  this.playlistInfo.playlistTracks = resa.data.songs
262
261
  if (this.roomInfo.roomId) {
263
262
  const resb = await axios({
@@ -274,7 +273,7 @@
274
273
  cookie: localStorage.getItem('cookie'),
275
274
  },
276
275
  })
277
- logger.info(resb)
276
+ console.info(resb)
278
277
  }
279
278
  },
280
279
  gotoTrack: async function (trackId) {
@@ -317,7 +316,7 @@
317
316
  cookie: localStorage.getItem('cookie'),
318
317
  },
319
318
  })
320
- logger.info(res)
319
+ console.info(res)
321
320
  },
322
321
  }).mount()
323
322
  </script>
@@ -24,7 +24,7 @@
24
24
  })
25
25
  const key = res.data.data.unikey
26
26
  const res2 = await axios({
27
- url: `/login/qr/create?key=${key}&qrimg=true&timestamp=${Date.now()}`,
27
+ url: `/login/qr/create?key=${key}&platform=web&qrimg=true&timestamp=${Date.now()}`,
28
28
  })
29
29
  document.querySelector('#qrImg').src = res2.data.data.qrimg
30
30
 
@@ -23,7 +23,7 @@
23
23
  })
24
24
  const key = res.data.data.unikey
25
25
  const res2 = await axios({
26
- url: `/login/qr/create?key=${key}&qrimg=true&timestamp=${Date.now()}&ua=pc`,
26
+ url: `/login/qr/create?key=${key}&platform=web&qrimg=true&timestamp=${Date.now()}&ua=pc`,
27
27
  })
28
28
  document.querySelector('#qrImg').src = res2.data.data.qrimg
29
29
 
@@ -35,7 +35,6 @@
35
35
  <script src="https://fastly.jsdelivr.net/npm/axios@0.26.1/dist/axios.min.js"></script>
36
36
  <script src="https://fastly.jsdelivr.net/npm/vue"></script>
37
37
  <script>
38
- const logger = require('../util/logger.js')
39
38
  Vue.createApp({
40
39
  data() {
41
40
  return {
@@ -62,7 +61,7 @@
62
61
  },
63
62
  methods: {
64
63
  submit() {
65
- logger.info('submit')
64
+ console.info('submit')
66
65
  const file = document.querySelector('input[type=file]').files[0]
67
66
  this.upload(file)
68
67
  },
@@ -72,14 +71,14 @@
72
71
  url: `/voicelist/search?cookie=${localStorage.getItem('cookie')}`,
73
72
  })
74
73
 
75
- logger.info(res.data.data)
74
+ console.info(res.data.data)
76
75
  this.voicelist = res.data.data.list
77
76
  this.voicelist.map(async (i) => {
78
77
  const res2 = await axios({
79
78
  url: `/voicelist/list?voiceListId=${i.voiceListId}&limit=5`,
80
79
  })
81
80
  i.voiceListData = res2.data.data.list
82
- logger.info(res2)
81
+ console.info(res2)
83
82
  })
84
83
  },
85
84
  upload(file) {
@@ -104,11 +103,11 @@
104
103
  .then((res) => {
105
104
  alert(`${file.name} 上传成功`)
106
105
  if (currentIndx >= fileLength) {
107
- logger.info('上传完毕')
106
+ console.info('上传完毕')
108
107
  }
109
108
  })
110
109
  .catch(async (err) => {
111
- logger.info(err)
110
+ console.info(err)
112
111
  })
113
112
  },
114
113
  },
@@ -9,9 +9,9 @@ class AdvancedClientSignGenerator {
9
9
  try {
10
10
  const interfaces = os.networkInterfaces()
11
11
  for (let interfaceName in interfaces) {
12
- const networkInterface = interfaces[interfaceName]
13
- for (let i = 0; i < networkInterface.length; i++) {
14
- const alias = networkInterface[i]
12
+ const interfaceItem = interfaces[interfaceName]
13
+ for (let i = 0; i < interfaceItem.length; i++) {
14
+ const alias = interfaceItem[i]
15
15
  // 排除内部地址和无效地址
16
16
  if (
17
17
  alias.mac &&
@@ -166,4 +166,4 @@ class AdvancedClientSignGenerator {
166
166
  }
167
167
  }
168
168
 
169
- module.exports = AdvancedClientSignGenerator
169
+ module.exports = AdvancedClientSignGenerator