mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-03-21 11:03:15 +00:00
Compare commits
No commits in common. "b6a1f9ce0aeaf114831c488dc9253834413f1d72" and "a9332af453a5a2ddf4e7d8dcb1a46bdc30d4effb" have entirely different histories.
b6a1f9ce0a
...
a9332af453
@ -1,53 +0,0 @@
|
|||||||
// 获取客户端歌曲下载链接 - v1
|
|
||||||
// 此版本不再采用 br 作为音质区分的标准
|
|
||||||
// 而是采用 standard, exhigh, lossless, hires, jyeffect(高清环绕声), sky(沉浸环绕声), jymaster(超清母带) 进行音质判断
|
|
||||||
|
|
||||||
const createOption = require('../util/option.js')
|
|
||||||
module.exports = async (query, request) => {
|
|
||||||
const data = {
|
|
||||||
id: query.id,
|
|
||||||
immerseType: 'c51',
|
|
||||||
level: query.level,
|
|
||||||
}
|
|
||||||
const response = await request(
|
|
||||||
`/api/song/enhance/download/url/v1`,
|
|
||||||
data,
|
|
||||||
createOption(query),
|
|
||||||
)
|
|
||||||
let url = response?.body?.data?.[0]?.url
|
|
||||||
|
|
||||||
if (!url) {
|
|
||||||
const fallbackData = {
|
|
||||||
ids: `[${query.id}]`,
|
|
||||||
level: query.level,
|
|
||||||
encodeType: 'flac',
|
|
||||||
}
|
|
||||||
if (query.level === 'sky') {
|
|
||||||
fallbackData.immerseType = 'c51'
|
|
||||||
}
|
|
||||||
const fallback = await request(
|
|
||||||
`/api/song/enhance/player/url/v1`,
|
|
||||||
fallbackData,
|
|
||||||
createOption(query),
|
|
||||||
)
|
|
||||||
url = fallback?.body?.data?.[0]?.url
|
|
||||||
|
|
||||||
if (!url) {
|
|
||||||
return fallback
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
status: 302,
|
|
||||||
body: '',
|
|
||||||
cookie: fallback.cookie || [],
|
|
||||||
redirectUrl: url,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
status: 302,
|
|
||||||
body: '',
|
|
||||||
cookie: response.cookie || [],
|
|
||||||
redirectUrl: url,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1254,21 +1254,6 @@ tags: 歌单标签
|
|||||||
|
|
||||||
说明:`杜比全景声`音质需要设备支持,不同的设备可能会返回不同码率的 url。cookie 需要传入`os=pc`保证返回正常码率的 url。
|
说明:`杜比全景声`音质需要设备支持,不同的设备可能会返回不同码率的 url。cookie 需要传入`os=pc`保证返回正常码率的 url。
|
||||||
|
|
||||||
### 302到音乐 url - 新版
|
|
||||||
|
|
||||||
说明 : 只允许传入单个`id`,会使用302重定向请求到目标url
|
|
||||||
|
|
||||||
**必选参数 :** `id` : 音乐 id
|
|
||||||
`level`: 播放音质等级, 分为 `standard` => `标准`,`higher` => `较高`, `exhigh`=>`极高`,
|
|
||||||
`lossless`=>`无损`, `hires`=>`Hi-Res`, `jyeffect` => `高清环绕声`, `sky` => `沉浸环绕声`, `dolby` => `杜比全景声`, `jymaster` => `超清母带`
|
|
||||||
`unblock`: 是否使用使用歌曲解锁, 分为`true`和`false`
|
|
||||||
|
|
||||||
**接口地址 :** `/song/url/v1/302`
|
|
||||||
|
|
||||||
**调用例子 :** `/song/url/v1/302?id=1969519579&level=exhigh`
|
|
||||||
|
|
||||||
说明:`杜比全景声`音质需要设备支持,不同的设备可能会返回不同码率的 url。cookie 需要传入`os=pc`保证返回正常码率的 url。
|
|
||||||
|
|
||||||
### 音乐是否可用
|
### 音乐是否可用
|
||||||
|
|
||||||
说明: 调用此接口,传入歌曲 id, 可获取音乐是否可用,返回 `{ success: true, message: 'ok' }` 或者 `{ success: false, message: '亲爱的,暂无版权' }`
|
说明: 调用此接口,传入歌曲 id, 可获取音乐是否可用,返回 `{ success: true, message: 'ok' }` 或者 `{ success: false, message: '亲爱的,暂无版权' }`
|
||||||
|
|||||||
@ -221,7 +221,7 @@ async function consturctServer(moduleDefs) {
|
|||||||
|
|
||||||
for (const moduleDef of moduleDefinitions) {
|
for (const moduleDef of moduleDefinitions) {
|
||||||
// Register the route.
|
// Register the route.
|
||||||
app.all(moduleDef.route, async (req, res) => {
|
app.use(moduleDef.route, async (req, res) => {
|
||||||
;[req.query, req.body].forEach((item) => {
|
;[req.query, req.body].forEach((item) => {
|
||||||
// item may be undefined (some environments / middlewares).
|
// item may be undefined (some environments / middlewares).
|
||||||
// Guard access to avoid "Cannot read properties of undefined (reading 'cookie')".
|
// Guard access to avoid "Cannot read properties of undefined (reading 'cookie')".
|
||||||
@ -308,11 +308,6 @@ async function consturctServer(moduleDefs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (moduleResponse.redirectUrl) {
|
|
||||||
res.redirect(moduleResponse.status || 302, moduleResponse.redirectUrl)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
res.status(moduleResponse.status).send(moduleResponse.body)
|
res.status(moduleResponse.status).send(moduleResponse.body)
|
||||||
} catch (/** @type {*} */ moduleResponse) {
|
} catch (/** @type {*} */ moduleResponse) {
|
||||||
logger.error(`${decode(req.originalUrl)}`, {
|
logger.error(`${decode(req.originalUrl)}`, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user