Skip to main content

The definitive python wrapper for MaimaiCN.

Project description

maimai.py (文档)

PyPI version License Python versions en

GitHub Repo stars GitHub forks PyPI - Downloads GitCode stars

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()
divingfish = DivingFishProvider(developer_token="your_token_here")

async def quick_start():
    # 获取所有歌曲及其元数据
    songs: MaimaiSongs = await maimai.songs()
    # 获取水鱼查分器用户 turou 的分数
    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

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maimai_py-1.3.8rc1.tar.gz (302.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maimai_py-1.3.8rc1-py3-none-any.whl (314.7 kB view details)

Uploaded Python 3

File details

Details for the file maimai_py-1.3.8rc1.tar.gz.

File metadata

  • Download URL: maimai_py-1.3.8rc1.tar.gz
  • Upload date:
  • Size: 302.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for maimai_py-1.3.8rc1.tar.gz
Algorithm Hash digest
SHA256 0684d25c5f8f83ee325c972e1187e9098291684bd619879cc931bea98d307fd6
MD5 24950fec4ca8f6400821866998e03ef8
BLAKE2b-256 f1d532c8f4d307eb09f98fdc9c372d278f2e0570b616dbad6903b9d690e1ac40

See more details on using hashes here.

File details

Details for the file maimai_py-1.3.8rc1-py3-none-any.whl.

File metadata

  • Download URL: maimai_py-1.3.8rc1-py3-none-any.whl
  • Upload date:
  • Size: 314.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for maimai_py-1.3.8rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ec934b8fbd5d9d9800da8d4aa5c59fb2a5775e3d48a544e9a062e123a03e487
MD5 d52f18735d45486810bf64d86e494b3c
BLAKE2b-256 a65eabcb086263dfe78ec8e37ae51b730fb12628e0fce89ace91b1d9fc05eb4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page