songs 歌曲
歌曲信息获取模块。
python
from bestdori import songs类型定义
SongInfo 歌曲信息
歌曲详细信息字典。 all.{index}.json 信息字典为该字典中选取部分字段信息。
| 字段名 | 类型 | 描述 |
|---|---|---|
| musicTitle | List[str | None] | 歌曲名定长列表 |
| tag | str | 歌曲种类 |
| bandId | int | 歌曲乐队 ID |
| jacketImage | List[str] | 歌曲封面链接列表。某些歌曲会有多个封面 |
| publishedAt | List[str | None] | 歌曲发布时间戳定长列表 |
| closedAt | List[str | None] | 歌曲下架时间戳定长列表 |
| difficulty | Dict[DifficultyString, Difficulty] | 歌曲难度信息字典 |
| length | float | 歌曲时长 |
| notes | Dict[DifficultyString, int] | 各难度谱面音符数字典 |
| bpm | Dict[DifficultyString, List[BPM]] | 各难度谱面 BPM 信息字典 |
| ruby | List[str | None] | 歌曲名拼写 (平假) 定长列表 |
| phonetic | List[str | None] | 歌曲名拼写 (片假) 定长列表 |
| lyricist | List[str | None] | 作词者名定长列表 |
| composer | List[str | None] | 作曲者名定长列表 |
| arranger | List[str | None] | 编曲者名定长列表 |
| bgmId | int | 歌曲资源文件 ID |
| bgmFile | str | 歌曲资源文件名 |
| achievements | List[Achievement] | 歌曲成就信息 |
| seq | int | 歌曲序列号 |
| howToGet | List[str | None] | 获取方式定长列表 |
| description | List[str | None] | 歌曲描述定长列表 |
Difficulty 歌曲难度
在该类型结构中,所有标识为 NotRequired 的字段中,除字段 publishedAt 以外的字段都不会出现在通过 get_all() 方法获取到的返回值中,而必定会出现在由 get_info() 方法获取到的返回值中。
| 字段名 | 类型 | 描述 |
|---|---|---|
| playLevel | int | 难度等级 |
| publishedAt NotRequired | List[str | None] | 难度发布时间戳定长列表 ,仅对额外添加的 SPECIAL 难度存在 |
| notesQuantity NotRequired | int | 音符数 |
| scoreC NotRequired | int | C 判定分数线 |
| scoreB NotRequired | int | B 判定分数线 |
| scoreA NotRequired | int | A 判定分数线 |
| scoreS NotRequired | int | S 判定分数线 |
| scoreSS NotRequired | int | SS 判定分数线 |
| scoreSSS NotRequired | int | SSS 判定分数线 |
| multiLiveScore NotRequired | Dict[MultiLiveDifficultyField, MultiLiveScoreMap] | 协力演出分数信息 |
MultiLiveScoreMap 协力演出分数信息
| 字段名 | 类型 | 描述 |
|---|---|---|
| musicId | int | 歌曲 ID |
| musicDifficulty | str | 谱面难度 |
| multiLiveDifficultyId | MultiLiveDifficultyId | 协力演出难度 ID |
| multiLiveDifficultyType | MultiLiveDifficultyType | 协力演出难度类型 |
| scoreC | int | C 判定分数线 |
| scoreB | int | B 判定分数线 |
| scoreA | int | A 判定分数线 |
| scoreS | int | S 判定分数线 |
| scoreSS | int | SS 判定分数线 |
| scoreSSS | int | SSS 判定分数线 |
MultiLiveDifficultyId - Type 协力演出难度 ID 与名称对照
MultiLiveDifficultyId / MultiLiveDifficultyField 与 MultiLiveDifficultyType 的对应关系。在获取到的信息中,两者的值总是一一对应的。
| MultiLiveDifficultyId | MultiLiveDifficultyField | MultiLiveDifficultyType |
|---|---|---|
2001 | '2001' | 'daredemo' |
2011 | '2011' | 'standard' |
2021 | '2021' | 'grand' |
2031 | '2031' | 'legend' |
BPM 歌曲 BPM 信息
| 字段名 | 类型 | 描述 |
|---|---|---|
| bpm | float | BPM 值 |
| start | float | BPM 起始节拍值 |
| end | float | BPM 结束节拍值 |
Achievement 歌曲成就
| 字段名 | 类型 | 描述 |
|---|---|---|
| musicId | int | 歌曲 ID |
| achievementType | str | 成就类型 |
| rewardType | str | 奖励类型 |
| quantity | int | 奖励数量 |
def get_all() async
| 参数名 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| index | int | 0 | 指定获取的 JSON 信息 |
| me keyword | Optional[Me] | None | 登录用户类 |
获取总歌曲信息,返回以歌曲 ID 为字段名、 SongsAllInfo 为字段值的信息字典, SongsAllInfo 为从 SongInfo 中截取出的部分信息。根据 index 参数值不同,获取到的 SongsAllInfo 所包含的信息也不同。
特别地,当 index 值为 0 时,返回值为以歌曲 ID 为字段名、 NoneDict 为字段值的字典
index 可用参数值
| 参数值 | 获取字段值末项字段名 |
|---|---|
| 0 | - |
| 1 | musicTitle |
| 5 | publishedAt |
| 7 | bpm |
| 8 | arranger |
Dict[str, SongsAllInfo | NoneDict]class Jacket()
歌曲封面类,包含歌曲封面相关资源整合。
| 属性名 | 类型 | 描述 |
|---|---|---|
| url | str | 封面图片链接 |
def init()
| 参数名 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| index | int | - | 数据包序列号 |
| jacket_image | str | - | 封面图片文件名 |
| server | ServerName | - | 封面所在服务器名称 |
def get_bytes() async
获取封面字节数据。
返回值:bytesclass Song()
歌曲类,包含歌曲相关资源整合。
def init()
| 参数名 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| id | int | - | 歌曲 ID |
| me keyword | Optional[Me] | None | 登录用户类 |
def get_info() async
获取歌曲信息。
返回值:SongInfodef get_jacket() async
获取歌曲封面对象列表 Jacket 。
List[Jacket]def get_chart() async
| 参数名 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| diff | DifficultyName | 'expert' | 难度名称 |
获取歌曲指定难度的谱面对象。
返回值:Chartdef get_bgm() async
获取歌曲音频资源文件字节数据。
返回值:bytesdef get_comment() async
| 参数名 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| limit | int | 20 | 获取到的帖子数量上限 |
| offset | int | 0 | 获取帖子时的偏移量 |
| order | Order | 'TIME_DESC' | 帖子排序方式 |
获取歌曲的社区评论列表。
返回值:PostList