This library is a node.js wrapper of osu!api v1.
You can look up the documentation here.
npm install @hizollo/osu-api
yarn add @hizollo/osu-api
Import the package:
// CommonJS
const { Client } = require('@hizollo/osu-api')
// ESM
import { Client } from '@hizollo/osu-api'
Create a client to interact with osu!api:
const osu = new Client({
apiKey: 'your-osu-api-key'
})
Get a user's data:
const user = await osu.users.getUser({
user: 'Cookiezi'
})
Get a player's top 5 play:
const bp = await osu.users.getUserBest({
user: '214187',
type: UserRequestType.Id,
mode: GameMode.Catch,
limit: 5
})
Fetch a player's banner:
// Fetch directly
const bannerURL = await osu.users.fetchBanner({
id: '7823498'
})
// ... or if you have the user object
const bannerURL = await user.fetchBanner();
This package is published under the MIT license.