mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2025-10-21 21:43:09 +00:00
feat: 支持直接在请求歌曲url使用unm server
This commit is contained in:
parent
fb2eb82a86
commit
b018be8695
@ -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'
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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) 的支持, 聚合多个音源匹配(有几率匹配不成功)
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 627 KiB After Width: | Height: | Size: 95 KiB |
Binary file not shown.
Before Width: | Height: | Size: 243 KiB After Width: | Height: | Size: 1.9 MiB |
Binary file not shown.
Before Width: | Height: | Size: 659 KiB |
@ -4,7 +4,7 @@ const host = global.host || 'http://localhost:3000'
|
||||
describe('测试获取歌词是否正常', () => {
|
||||
it('数据应该有 lrc 字段', (done) => {
|
||||
const qs = {
|
||||
id: 347230,
|
||||
id: 1969519579,
|
||||
realIP: global.cnIp,
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user