npm i osu-api-extended
yarn install osu-api-extended
pnpm install osu-api-extended
You can get your api key here
const { v1, auth } = require('osu-api-extended')
const main = async () => {
auth.set_v1(api_key)
const data = await v1.beatmap.diff(1256136)
console.log(data)
}
main()
You can create your client here
const { v2, auth } = require('osu-api-extended')
const main = async () => {
const SCOPE_LIST = ['public', ...];
// Auth via client
await auth.login('CLIENT_ID', 'CLIENT_SECRET', SCOPE_LIST);
// Auth via lazer credentials
await auth.login_lazer('YOUR_LOGIN', 'YOUR_PASSWORD');
// Auth via oauth2
await auth.authorize_cli('CLIENT_ID', 'CLIENT_SECRET', 'CALLBACK_URL', SCOPE_LIST);
const data = await v2.beatmap.id.details(1256136)
console.log(data)
}
main()
const { v2, auth } = require('osu-api-extended');
// code example for redirect page
const redirect_page = async () => {
const SCOPE_LIST = ['public', ...];
const url = auth.build_url('CLIENT_ID', 'CLIENT_CALLBACK_URL', SCOPE_LIST);
return url;
};
const callback_page = async () => {
const user_data = await auth.authorize(code, 'GAMEMODE', 'CLIENT_ID', 'CLIENT_SECRET', 'CLIENT_CALLBACK_URL');
return user_data;
};
// discord bot auth | REQUEIRE TO HAVE A SITE WHERE YOU'LL REDIRECT USERS AFTER AUTH
const discord_auth_link = async () => {
const SCOPE_LIST = ['public', ...];
const url = auth.build_url('CLIENT_ID', 'CLIENT_CALLBACK_URL', SCOPE_LIST, 'DICSORD_USER_ID');
return url;
};
const discord_callback_page = async (code, state) => {
const user_data = await auth.authorize(code, 'GAMEMODE', 'CLIENT_ID', 'CLIENT_SECRET', 'CLIENT_CALLBACK_URL');
return {
discord_user_id: state,
user_data
};
};
const { tools } = require('osu-api-extended')
const main = async () => {
// Accuracy from hits
const accuracy = tools.accuracy(300, 5, 10, 0, 0, 0, 'osu')
// Country name from country code
const country_name = tools.country('RU')
// Download difficulty file
const diff_file = tools.download.difficulty(2379651, './', '2379651')
// Calucalute pp for a difficulty
const pp_calc = tools.pp_calc(2379651)
// Rank letter from hits
const rank = tools.rank(
{
geki: 236,
katu: 43,
300: 640,
100: 54,
50: 5,
0: 15
},
'osu'
)
console.log({ accuracy, country_name, diff_file, pp_calc, rank })
}
main()
const { mods } = require('osu-api-extended')
const main = async () => {
// Mods name from mods id
const name = mods.name(64) // DT
// Mods id from mods name
const id = mods.id('HDDT') // 72
console.log({ name, id })
}
main()
- lzma-native: decompress data from replay
- node-osr: Working with replay file
request.ts
by AqilCont