Never Punch Manticores

    osu-api-extended
    TypeScript icon, indicating that this package has built-in type declarations

    2.5.10 • Public • Published

    osu-api-extended

    Usage

    Documentation

    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

    Install

    npm i osu-api-extended

    DownloadsWeekly Downloads

    28

    Version

    2.5.10

    License

    MIT

    Unpacked Size

    420 kB

    Total Files

    266

    Last publish

    Collaborators

    • cyperdark