Coder Social home page Coder Social logo

osu-api-extended's Introduction

osu-api-extended

Usage

Installation

npm i osu-api-extended

API V1

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 v2.beatmap.diff(1256136)
  console.log(data)
}

main()

API V2

You can create your client here

const { v2, auth } = require('osu-api-extended')

const main = async () => {
  // Auth via client
  await auth.login('CLIENT_ID', 'CLIENT_SECRET')

  // Auth via lazer credentials
  await auth.login_lazer('YOUR_LOGIN', 'YOUR_PASSWORD')

  // Auth via oauth2
  await auth.authorize('CLIENT_ID', 'CLIENT_SECRET', 'CALLBACK_URL')

  const data = await v2.beatmap.diff(1256136)
  console.log(data)
}

main()

Tools

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 form 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()

Mods

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()

Dependencies

osu-api-extended's People

Contributors

keziahmoselle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.