mirror of
https://github.com/NeteaseCloudMusicApiEnhanced/api-enhanced.git
synced 2026-10-20 22:51:23 +08:00
feat: 新增助眠解压相关模块 && bump 4.32.0
This commit is contained in:
@@ -188,6 +188,35 @@
|
||||
document.getElementById('result').value = 'Request failed: ' + error.message;
|
||||
}
|
||||
}
|
||||
|
||||
(function fillFromQuery() {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
if (!params.toString()) return;
|
||||
const uri = params.get('uri');
|
||||
const crypto = params.get('crypto');
|
||||
const dataParam = params.get('data');
|
||||
if (uri) {
|
||||
document.getElementById('uri').value = uri;
|
||||
}
|
||||
if (crypto) {
|
||||
const cryptoSelect = document.getElementById('crypto');
|
||||
if ([...cryptoSelect.options].some((opt) => opt.value === crypto)) {
|
||||
cryptoSelect.value = crypto;
|
||||
}
|
||||
}
|
||||
if (dataParam) {
|
||||
const decoded = dataParam;
|
||||
try {
|
||||
document.getElementById('data').value = JSON.stringify(
|
||||
JSON.parse(decoded),
|
||||
null,
|
||||
2,
|
||||
);
|
||||
} catch (error) {
|
||||
document.getElementById('data').value = decoded;
|
||||
}
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -209,6 +209,12 @@ $ sudo docker build . -t netease-music-api
|
||||
$ sudo docker run -d -p 3000:3000 netease-music-api
|
||||
```
|
||||
|
||||
## 调试工具
|
||||
|
||||
- `eapi` 请求参数或返回内容可在 `/eapi_decrypt.html` 里解析
|
||||
- 请求参数模式下, 解密结果可直接带到 `/api.html` 继续调试
|
||||
- 需要返回值加密时, 可传 `e_r=1`, `weapi` 和 `eapi` 都支持
|
||||
|
||||
## 接口文档
|
||||
|
||||
### 调用前须知
|
||||
@@ -5031,6 +5037,21 @@ let data = encodeURIComponent(
|
||||
|
||||
**调用例子:** `/vip/sign/info`
|
||||
|
||||
### 广播电台 - 收藏/取消收藏电台
|
||||
|
||||
说明: 登录后调用此接口, 传入电台 id, 可收藏或取消收藏广播电台
|
||||
|
||||
**必选参数:**
|
||||
|
||||
`id`: 电台 id
|
||||
|
||||
`t`: 操作类型, `1` 为收藏, 其余值为取消收藏
|
||||
|
||||
**接口地址:** `/broadcast/sub`
|
||||
|
||||
**调用例子:** `/broadcast/sub?id=5&t=1`
|
||||
|
||||
|
||||
### 用户的创建歌单列表
|
||||
|
||||
说明 : 调用此接口, 传入用户id, 获取用户的创建歌单列表
|
||||
@@ -5209,6 +5230,92 @@ let data = encodeURIComponent(
|
||||
|
||||
**调用例子:** `/dj/difm/playing/tracks/list?source=0&channelId=1012`
|
||||
|
||||
### 助眠解压 - 特定时间场景下的推荐资源
|
||||
|
||||
说明: 调用此接口, 获取特定时间场景下的推荐资源
|
||||
|
||||
**接口地址:** `/sati/timescene/resources/get`
|
||||
|
||||
**调用例子:** `/sati/timescene/resources/get`
|
||||
|
||||
### 助眠解压 - 标签列表
|
||||
|
||||
说明: 调用此接口, 获取标签列表
|
||||
|
||||
**接口地址:** `/sati/tag/list`
|
||||
|
||||
**调用例子:** `/sati/tag/list`
|
||||
|
||||
### 助眠解压 - 获取标签下资源列表
|
||||
|
||||
说明: 调用此接口, 获取标签下资源列表; 接口返回的`trackId`可以用于请求`/song/url/v1`接口,用于获取声音的下载地址
|
||||
|
||||
**必选参数 :**
|
||||
|
||||
`tag`: 标签, 由标签列表接口得到
|
||||
|
||||
**接口地址:** `/sati/resource/list`
|
||||
|
||||
**调用例子:** `/sati/resource/list?tag=naturalMusic`
|
||||
|
||||
### 助眠解压 - 查看同类推荐
|
||||
|
||||
说明: 调用此接口, 查看同类推荐
|
||||
|
||||
**必选参数 :**
|
||||
|
||||
`id`: id, `/sati/tag/list`接口返回的`trackId`
|
||||
|
||||
**接口地址:** `/sati/resource/list/more`
|
||||
|
||||
**调用例子:** `/sati/resource/list/more?id=167003`
|
||||
|
||||
### 助眠解压 - 收藏列表
|
||||
|
||||
说明: 调用此接口, 获取收藏列表
|
||||
|
||||
**接口地址:** `/sati/resource/sub/list`
|
||||
|
||||
**调用例子:** `/sati/resource/sub/list`
|
||||
|
||||
### 助眠解压 - 收藏
|
||||
|
||||
说明: 调用此接口, 收藏声音
|
||||
|
||||
**必选参数 :**
|
||||
|
||||
`id`: id, `/sati/tag/list`接口返回的`trackId`
|
||||
|
||||
**可选参数 :**
|
||||
|
||||
`cancel`: 是否取消收藏, 默认不取消
|
||||
|
||||
**接口地址:** `/sati/resource/sub`
|
||||
|
||||
**调用例子:** `/sati/resource/sub?id=167003`
|
||||
|
||||
### 跑步漫游
|
||||
|
||||
说明: 调用此接口,获取跑步漫游的歌曲信息
|
||||
|
||||
**必选参数:**
|
||||
|
||||
`bpm`: 步频
|
||||
|
||||
**接口地址:** `/radio/sport/get`
|
||||
|
||||
**调用例子:** `/radio/sport/get?bpm=50`
|
||||
|
||||
### 歌曲创作者信息
|
||||
|
||||
说明 : 调用此接口, 传入音乐 id 可获得对应音乐的创作者信息
|
||||
|
||||
**必选参数 :** `id`: 音乐 id
|
||||
|
||||
**接口地址 :** `/song/creators`
|
||||
|
||||
**调用例子 :** `/song/creators?id=33894312`
|
||||
|
||||
## 离线访问此文档
|
||||
|
||||
此文档同时也是 Progressive Web Apps(PWA), 加入了 serviceWorker, 可离线访问
|
||||
|
||||
@@ -96,6 +96,10 @@
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
button + button {
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #555;
|
||||
}
|
||||
@@ -166,6 +170,7 @@
|
||||
</div>
|
||||
|
||||
<button @click="decrypt">解密</button>
|
||||
<button @click="sendToApi" :disabled="!canSend" :class="[{ 'opacity-50 cursor-not-allowed pointer-events-none': !canSend },]">填入 API 调试</button>
|
||||
|
||||
<div class="result-section">
|
||||
<label>解密结果:</label>
|
||||
@@ -194,12 +199,29 @@
|
||||
mounted() {
|
||||
this.decrypt()
|
||||
},
|
||||
methods: {
|
||||
formatResult(result) {
|
||||
computed: {
|
||||
isRequestMode() {
|
||||
return this.isReq === true || this.isReq === 'true'
|
||||
},
|
||||
canSend() {
|
||||
if (!this.isRequestMode) return false
|
||||
if (!this.result || this.result === '{}' || this.result === 'null') return false
|
||||
try {
|
||||
return JSON.stringify(JSON.parse(result), null, 2)
|
||||
} catch (e) {
|
||||
return result
|
||||
JSON.parse(this.result)
|
||||
return true
|
||||
} catch (error) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
formatResult(value) {
|
||||
if (value == null || value === '') return ''
|
||||
try {
|
||||
const parsed = typeof value === 'string' ? JSON.parse(value) : value
|
||||
return JSON.stringify(parsed, null, 2)
|
||||
} catch (error) {
|
||||
return String(value)
|
||||
}
|
||||
},
|
||||
async decrypt() {
|
||||
@@ -215,9 +237,25 @@
|
||||
console.log(res.data);
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
alert(error?.response?.data?.message || '解密失败,数据格式错误')
|
||||
alert(error?.response?.data?.message || '解密失败,数据格式错误')
|
||||
}
|
||||
}
|
||||
},
|
||||
sendToApi() {
|
||||
if (!this.canSend) return
|
||||
const payload = JSON.parse(this.result)
|
||||
const params = new URLSearchParams()
|
||||
params.set('uri', payload.uri || payload.url || payload.path || '')
|
||||
params.set('crypto', 'eapi')
|
||||
const data =
|
||||
payload.params ||
|
||||
payload.data ||
|
||||
payload.body ||
|
||||
payload.payload ||
|
||||
payload.request ||
|
||||
{}
|
||||
params.set('data', JSON.stringify(data))
|
||||
window.open(`/api.html?${params.toString()}`, '_blank')
|
||||
},
|
||||
}
|
||||
})
|
||||
app.mount('#app')
|
||||
|
||||
Reference in New Issue
Block a user