diff --git a/module/song_url_v1.js b/module/song_url_v1.js index af222a3..888faf4 100644 --- a/module/song_url_v1.js +++ b/module/song_url_v1.js @@ -1,14 +1,45 @@ // 歌曲链接 - v1 // 此版本不再采用 br 作为音质区分的标准 // 而是采用 standard, exhigh, lossless, hires, jyeffect(高清环绕声), sky(沉浸环绕声), jymaster(超清母带) 进行音质判断 +// 当unblock为true时, 会尝试使用unblockneteasemusic进行解锁, 同时音质设置不会生效, 但仍然为必须传入参数 const createOption = require('../util/option.js') -module.exports = (query, request) => { +module.exports = async (query, request) => { + const match = require('@unblockneteasemusic/server') + const source = ['pyncmd','kuwo', 'qq', 'migu', 'kugou'] + require('dotenv').config() const data = { ids: '[' + query.id + ']', level: query.level, encodeType: 'flac', } + if (query.unblock === 'true') { + try { + const result = await match(query.id, source) + let url = Array.isArray(result) ? (result[0]?.url || result[0]) : (result.url || result) + if (url) { + return { + status: 200, + body: { + code: 200, + data: [ + { + id: Number(query.id), + url, + type: 'flac', + level: query.level, + freeTrialInfo: 'unblock', + fee: 0, + }, + ], + }, + cookie: [], + } + } + } catch (e) { + console.error('Error in unblockneteasemusic:', e) + } + } if (data.level == 'sky') { data.immerseType = 'c51' } diff --git a/package.json b/package.json index becd7c8..e03c770 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,13 @@ { +<<<<<<< HEAD "name": "NeteaseCloudMusicApi", "version": "4.25.0", "description": "网易云音乐 NodeJS 版 API", +======= + "name": "@neteaseapireborn/api", + "version": "4.28.10", + "description": "为停更的网易云音乐 NodeJs API 提供持续的维护!", +>>>>>>> 05bedc6 (feat: 支持直接在请求歌曲url使用unm server) "scripts": { "start": "node app.js", "test": "mocha -r intelli-espower-loader -t 60000 server.test.js main.test.js --exit", diff --git a/public/docs/home.md b/public/docs/home.md index f64606b..bbde81d 100644 --- a/public/docs/home.md +++ b/public/docs/home.md @@ -1544,7 +1544,8 @@ tags: 歌单标签 **必选参数 :** `id` : 音乐 id `level`: 播放音质等级, 分为 `standard` => `标准`,`higher` => `较高`, `exhigh`=>`极高`, -`lossless`=>`无损`, `hires`=>`Hi-Res`, `jyeffect` => `高清环绕声`, `sky` => `沉浸环绕声`, `dolby` => `杜比全景声`, `jymaster` => `超清母带` +`lossless`=>`无损`, `hires`=>`Hi-Res`, `jyeffect` => `高清环绕声`, `sky` => `沉浸环绕声`, `dolby` => `杜比全景声`, `jymaster` => `超清母带` + `unblock`: 是否使用`UnblockNeteaseMusic`, 分为`true`和`false` **接口地址 :** `/song/url/v1` @@ -1564,7 +1565,7 @@ tags: 歌单标签 **调用例子 :** `/check/music?id=1969519579` -### 获取客户端灰色歌曲链接 +### 直接获取灰色歌曲链接 说明 : 技术来自于 [UnblockNeteaseMusic](https://github.com/unblockneteasemusic/server) 的支持, 聚合多个音源匹配(有几率匹配不成功) diff --git a/public/static/docs.png b/public/static/docs.png index 1f1794a..fab73b9 100644 Binary files a/public/static/docs.png and b/public/static/docs.png differ diff --git a/public/static/screenshot1.png b/public/static/screenshot1.png index eb20062..97b1992 100644 Binary files a/public/static/screenshot1.png and b/public/static/screenshot1.png differ diff --git a/public/static/screenshot2.png b/public/static/screenshot2.png deleted file mode 100644 index 1d8418d..0000000 Binary files a/public/static/screenshot2.png and /dev/null differ diff --git a/test/lyric.test.js b/test/lyric.test.js index 993a890..ebff840 100644 --- a/test/lyric.test.js +++ b/test/lyric.test.js @@ -4,7 +4,7 @@ const host = global.host || 'http://localhost:3000' describe('测试获取歌词是否正常', () => { it('数据应该有 lrc 字段', (done) => { const qs = { - id: 347230, + id: 1969519579, realIP: global.cnIp, } diff --git a/test/music_url.test.js b/test/music_url.test.js index 85b03c8..46deaaf 100644 --- a/test/music_url.test.js +++ b/test/music_url.test.js @@ -4,7 +4,7 @@ const host = global.host || 'http://localhost:3000' describe('测试获取歌曲是否正常', () => { it('歌曲的 url 不应该为空', (done) => { const qs = { - id: 464315036, + id: 1969519579, br: 999000, realIP: global.cnIp, }