Skip to content

Commit

Permalink
Merge pull request Binaryify#1583 from kengwang/master
Browse files Browse the repository at this point in the history
[feat] 新增新版 音乐链接获取 API
  • Loading branch information
Binaryify authored Aug 23, 2022
2 parents d477141 + 647396f commit eb5c40b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,17 @@ tags: 歌单标签

**调用例子 :** `/song/url?id=33894312` `/song/url?id=405998841,33894312`

### 获取音乐 url - 新版

说明 : 使用注意事项同上

**必选参数 :** `id` : 音乐 id
`level`: 播放音质等级, 分为 `standard` => `标准`, `exhigh`=>`极高`, `lossless`=>`无损`, `hires`=>`Hi-Res`

**接口地址 :** `/song/url/v1`

**调用例子 :** `/song/url/v1?id=33894312&level=exhigh` `/song/url/v1?id=405998841,33894312&level=lossless`

### 音乐是否可用

说明: 调用此接口,传入歌曲 id, 可获取音乐是否可用,返回 `{ success: true, message: 'ok' }` 或者 `{ success: false, message: '亲爱的,暂无版权' }`
Expand Down
26 changes: 26 additions & 0 deletions module/song_url_v1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 歌曲链接 - v1
// 此版本不再采用 br 作为音质区分的标准
// 而是采用 standard, exhigh, lossless, hires 进行音质判断

const crypto = require('crypto')
module.exports = (query, request) => {
query.cookie.os = 'pc'
const data = {
ids: '[' + query.id + ']',
level: query.level,
encodeType: 'flac'
}
console.log(query)
return request(
'POST',
`https://interface.music.163.com/eapi/song/enhance/player/url/v1`,
data,
{
crypto: 'eapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
url: '/api/song/enhance/player/url/v1',
},
)
}

0 comments on commit eb5c40b

Please sign in to comment.