npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-scoresaber

v2.0.2

Published

Scoresaber API wrapper

Downloads

8

Readme

https://github.com/SpikeHD/node-scoresaber https://github.com/SpikeHD/node-scoresaber https://www.npmjs.com/package/node-scoresaber

node-scoresaber

A NodeJS API wrapper for https://new.scoresaber.com/

https://www.npmjs.com/package/node-scoresaber

Description

node-scoresaber is an asynchronous function-based API wrapper for scoresaber.com written in Javascript using axios. It supports viewing player stats, ranked request lists and request details, player searching, ~~and song leaderboards and details~~.

Installation

Simply run npm install node-scoresaber and require it in your program:

const saber = require('node-scoresaber')

Usage

Everything is based off of functions. Internally, these functions actually return instances of classes, which used to be how you would interact with this module until v2.0.0, but now it should be much cleaner and easier to use.

* All functions are asynchronous unless otherwise mentioned

Jump to:

Functions

Players

getPlayer(id)

| Parameter | Type | | --------- | ---- | | id | String or Number. Usually Steam ID or Oculus ID |

Returns

Return value: Object

| Property | Description | | -------- | ----------- | | name | Username of the player | | avatar_url | URL that points to player avatar | | rank | Current global rank | | countryRank | Current rank in their respective country | | country | Short-form version of player's respective country | | pp | Total PP | | role | Player role (eg."Supporter") | badges | Array of badges the player has, and their image links | | isBanned | Boolean - whether player is banned | | isInactive | Boolean - whether player is inactive | | totalScore | Total score earned | | totalRankedScore | Total score for ranked songs only | | averageRankedAccuracy | Average ranked accuracy | | playCount | Total amount of plays | | rankedPlayCount | Total amount of ranked plays |


searchPlayers(name)

| Parameter | Type | | --------- | ---- | | name | String |

Returns

Return value: Array of Objects

Each object contains:

| Property | Description | | -------- | ----------- | | playerId | ID of player | | playerName | Name of player | | rank | Current global rank | | pp | Current total PP | | avatar | URL that points to player avatar | | country | Short-form version of player's respective country | | history | Array of ranking history | | difference | Rank difference from the last 2 weeks | | get | Async function, shorthand for getPlayer() (does not require ID param) |

Requests

getRequest(id)

| Parameter | Type | | --------- | ---- | | id | String or Number |

Returns

Return value: Object

| Property | Description | | -------- | ----------- | | default_url | Root scoresaber URL | | request | Request ID | | songID | Song ID | | requestType | Number, not sure what it means | | description | Request description | | approved | Boolean - whether request has been approved | | id | Some other ID | | difficulty | Number. Correlation: Easy -> 1, Normal -> 3, Hard -> 5, Expert -> 7, Expert+ -> 9, etc. | | rankUpvotes | Rank upvotes | | rankDownvotes | Rank downvotes | | qatUpvotes | QAT Upvotes | | qatDownvotes | QAT Downvotes | | rankComments | Array of rank comments | | qatComments | Array of QAT comments | | Difficulties | Array of objects containing the requests other difficulties |


getAllRequests() and getTopRequests()

  • No Parameters -

Returns

Return value: Array of Objects

Each object contains:

| Parameter | Description | | --------- | ----------- | | request | ID of the request | | songId | Song ID | | weight | Request weight | | name | Song name | | levelAuthorName | Name of the author | | id | Some other ID | | created_at | Timestamp of request creation | | rankVotes | Object with keys: upvotes, downvotes, myVote | | qatVotes | Object with keys: upvotes, downvotes, myVote | | difficulties | Number of difficulties | | get | Async function, shorthand for getRequest() (does not require ID param) |

Examples

Searching for and getting details of a player

const myPlayer = await saber.searchPlayers('spikehd')

if (myPlayer[0]) {
  console.log(await myPlayer[0].get())
}

Getting a player by ID

const myPlayer = await saber.getPlayer('76561198106696130')
console.log(myPlayer)

Getting a top request

const topRequests = await saber.getTopRequests()

if (topRequests[0]) {
  console.log(await topRequests[0].get())
}

Getting a request by ID

const request = await saber.getRequest('1234')
console.log(request)

Contributing

Issues, PRs, etc., are all welcome!