Skip to content

Commit

Permalink
Merge pull request Binaryify#1623 from chen310/patch
Browse files Browse the repository at this point in the history
feat: 增加若干曲风相关接口
  • Loading branch information
Binaryify authored Oct 10, 2022
2 parents 06dec2e + ccaa4bc commit aa54bd8
Show file tree
Hide file tree
Showing 9 changed files with 268 additions and 0 deletions.
95 changes: 95 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,16 @@
240. 内部版本接口
241. 歌单更新播放量
242. 黑胶时光机
243. 音乐百科 - 简要信息
244. 乐谱列表
245. 乐谱内容
246. 曲风列表
247. 曲风偏好
248. 曲风详情
249. 曲风-歌曲
250. 曲风-专辑
251. 曲风-歌单
252. 曲风-歌手

## 安装

Expand Down Expand Up @@ -3930,6 +3940,91 @@ type='1009' 获取其 id, 如`/search?keywords= 代码时间 &type=1009`
**调用例子:** `/sheet/preview?id=245206`
### 曲风列表
说明: 调用此接口获取曲风列表及其对应的 `tagId`
**接口地址:** `/style/list`
**调用例子:** `/style/list`
### 曲风偏好
说明: 登陆后调用此接口获取我的曲风偏好
**接口地址:** `/style/preference`
**调用例子:** `/style/preference`
### 曲风详情
说明: 调用此接口可以获取该曲风的描述信息
**接口地址:** `/style/detail`
**必选参数:** `tagId`: 曲风 ID
**调用例子:** `/style/detail?tagId=1000`
### 曲风-歌曲
说明: 调用此接口可以获取该曲风对应的歌曲
**接口地址:** `/style/song`
**必选参数:** `tagId`: 曲风 ID
**可选参数 :** `size` : 返回数量 , 默认为 20
`cursor` : 返回数据的 cursor, 默认为 0 , 传入上一次返回结果的 cursor,将会返回下一页的数据
`sort`: 排序方式,0: 按热度排序,1: 按时间排序
**调用例子:** `/style/song?tagId=1000` `/style/song?tagId=1010&sort=1`
### 曲风-专辑
说明: 调用此接口可以获取该曲风对应的专辑
**接口地址:** `/style/album`
**必选参数:** `tagId`: 曲风 ID
**可选参数 :** `size` : 返回数量 , 默认为 20
`cursor` : 返回数据的 cursor, 默认为 0 , 传入上一次返回结果的 cursor,将会返回下一页的数据
`sort`: 排序方式,0: 按热度排序,1: 按时间排序
**调用例子:** `/style/album?tagId=1000` `/style/album?tagId=1010&sort=1`
### 曲风-歌单
说明: 调用此接口可以获取该曲风对应的歌单
**接口地址:** `/style/playlist`
**必选参数:** `tagId`: 曲风 ID
**可选参数 :** `size` : 返回数量 , 默认为 20
`cursor` : 返回数据的 cursor, 默认为 0 , 传入上一次返回结果的 cursor,将会返回下一页的数据
**调用例子:** `/style/playlist?tagId=1000`
### 曲风-歌手
说明: 调用此接口可以获取该曲风对应的歌手
**接口地址:** `/style/artist`
**必选参数:** `tagId`: 曲风 ID
**可选参数 :** `size` : 返回数量 , 默认为 20
`cursor` : 返回数据的 cursor, 默认为 0 , 传入上一次返回结果的 cursor,将会返回下一页的数据
**调用例子:** `/style/artist?tagId=1000`
## 离线访问此文档
Expand Down
44 changes: 44 additions & 0 deletions interface.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1653,3 +1653,47 @@ export function sheet_preview(
id: number | string
} & RequestBaseConfig,
): Promise<Response>

export function style_list(params: RequestBaseConfig): Promise<Response>

export function style_preference(params: RequestBaseConfig): Promise<Response>

export function style_detail(
params: {
tagId: number | string
} & RequestBaseConfig,
): Promise<Response>

export function style_song(
params: {
tagId: number | string
size?: number | string
cursor?: number | string
sort?: number | string
} & RequestBaseConfig,
): Promise<Response>

export function style_album(
params: {
tagId: number | string
size?: number | string
cursor?: number | string
sort?: number | string
} & RequestBaseConfig,
): Promise<Response>

export function style_playlist(
params: {
tagId: number | string
size?: number | string
cursor?: number | string
} & RequestBaseConfig,
): Promise<Response>

export function style_artist(
params: {
tagId: number | string
size?: number | string
cursor?: number | string
} & RequestBaseConfig,
): Promise<Response>
21 changes: 21 additions & 0 deletions module/style_album.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 曲风-专辑

module.exports = (query, request) => {
const data = {
cursor: query.cursor || 0,
size: query.size || 20,
tagId: query.tagId,
sort: query.sort || 0,
}
return request(
'POST',
`https://music.163.com/api/style-tag/home/album`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
21 changes: 21 additions & 0 deletions module/style_artist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 曲风-歌手

module.exports = (query, request) => {
const data = {
cursor: query.cursor || 0,
size: query.size || 20,
tagId: query.tagId,
sort: 0,
}
return request(
'POST',
`https://music.163.com/api/style-tag/home/artist`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
18 changes: 18 additions & 0 deletions module/style_detail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 曲风详情

module.exports = (query, request) => {
const data = {
tagId: query.tagId,
}
return request(
'POST',
`https://music.163.com/api/style-tag/home/head`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
11 changes: 11 additions & 0 deletions module/style_list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// 曲风列表

module.exports = (query, request) => {
const data = {}
return request('POST', `https://music.163.com/api/tag/list/get`, data, {
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
})
}
21 changes: 21 additions & 0 deletions module/style_playlist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 曲风-歌单

module.exports = (query, request) => {
const data = {
cursor: query.cursor || 0,
size: query.size || 20,
tagId: query.tagId,
sort: 0,
}
return request(
'POST',
`https://music.163.com/api/style-tag/home/playlist`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
16 changes: 16 additions & 0 deletions module/style_preference.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 曲风偏好

module.exports = (query, request) => {
const data = {}
return request(
'POST',
`https://music.163.com/api/tag/my/preference/get`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}
21 changes: 21 additions & 0 deletions module/style_song.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 曲风-歌曲

module.exports = (query, request) => {
const data = {
cursor: query.cursor || 0,
size: query.size || 20,
tagId: query.tagId,
sort: query.sort || 0,
}
return request(
'POST',
`https://music.163.com/api/style-tag/home/song`,
data,
{
crypto: 'weapi',
cookie: query.cookie,
proxy: query.proxy,
realIP: query.realIP,
},
)
}

0 comments on commit aa54bd8

Please sign in to comment.