maimai.py (文档)
用于国服舞萌相关开发的最佳Python工具库, 封装水鱼/落雪查分器常用函数.
提供了基于日服舞萌标准的数据模型和接口, 为水鱼和落雪分别做了数据源实现.
支持从数据源查询歌曲、谱面、玩家信息、分数、Rating、姓名框、牌子进度.
另外, 支持联动微信 OpenID 获取玩家分数, 解析分数HTML, 并上传至数据源.
使用方式
pip install maimai-py
升级方式:
pip install -U maimai-py
另外, 您也可以下载 maimai.py 客户端, 使用任何编程语言进行开发.
快速开始
import asyncio
from maimai_py import MaimaiClient, MaimaiPlates, MaimaiScores, MaimaiSongs, PlayerIdentifier, DivingFishProvider
# 全局创建 MaimaiClient 实例
maimai = MaimaiClient()
# 水鱼账号 OAuth:Provider 配置 client_id/client_secret,
# 以 PlayerIdentifier(ref="你的用户ID") 或 PlayerIdentifier(sub=12345) 指定玩家
divingfish = DivingFishProvider(client_id="your_client_id", client_secret="your_client_secret")
async def quick_start():
# 获取所有歌曲及其元数据
songs: MaimaiSongs = await maimai.songs()
# 获取水鱼查分器用户 turou 的分数(配置了 OAuth 凭据时,username 会走账号 OAuth)
scores: MaimaiScores = await maimai.scores(PlayerIdentifier(username="turou"), provider=divingfish)
# 获取水鱼查分器用户 turou 的舞将牌子信息
plates: MaimaiPlates = await maimai.plates(PlayerIdentifier(username="turou"), "舞将", provider=divingfish)
song = await songs.by_id(1231) # 生命不詳 by 蜂屋ななし
print(f"歌曲 1231 是: {song.artist} - {song.title}")
print(f"TuRou 的 Rating 为: {scores.rating}, b15 中最高 Rating 为: {scores.scores_b15[0].dx_rating}")
print(f"TuRou 的 舞将 完成度: {await plates.count_cleared()}/{await plates.count_all()}")
asyncio.run(quick_start())
更多内容请查看文档: https://maimai.turou.fun/.
异步
maimai.py 默认采用全异步, 且暂时没有提供同步方法和接口的计划.
如果您不希望采用异步, 可以使用 asyncio.run 包裹方法, 将异步方法同步调用.
客户端
maimai.py 提供了 RESTful API 客户端, 您可以通过任何语言通过HTTP请求来调用 maimai.py 的特性.
客户端使用 Nuitka 编译, 请在 Releases 页面下载.
我们的客户端支持 Windows, Linux, 请根据您的系统下载对应的版本.
客户端 Swagger 文档请查看: https://openapi.maimai.turou.fun/.
贡献
如果您想要贡献代码, 请阅读 CONTRIBUTING.md
讨论与交流 (QQ 群):
- UsagiPass 兔兔群: 363346002
- UsagiLab 内测Only: 515023302
Metadata
Release files for maimai-py 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maimai_py-1.6.1.tar.gz | 308.3 kB | Without provenance | Details for maimai_py-1.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maimai_py-1.6.1-py3-none-any.whl | Python 3 | none | any | Details for maimai_py-1.6.1-py3-none-any.whl |
Total release size: 628.8 kB
Release files / maimai_py-1.6.1.tar.gz
| Download URL | maimai_py-1.6.1.tar.gz |
|---|---|
| Size | 308.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
599323bed68948a49837c4582dc708f662c1b31412a4462a409a3bbbde6af7dd
|
|
BLAKE2b-256 checksum How to use checksums |
8e2c4fd68269f9620072b55bf24898296750fb2a4ab12d8ea5ddf87c162ed998
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.15 Linux/7.0.0-1017-azure
|
Release files / maimai_py-1.6.1-py3-none-any.whl
| Download URL | maimai_py-1.6.1-py3-none-any.whl |
|---|---|
| Size | 320.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21a99e962a7f11af81f56bea48b0033897d2f437fe33c4798032ae30bd8f9907
|
|
BLAKE2b-256 checksum How to use checksums |
a3b6f0c4988dc5cb8ea2537e9f075886b09320e0750bb4cf008cd0c4b301a7eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.12.15 Linux/7.0.0-1017-azure
|
Security for maimai-py 1.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.