oversmash
API wrapper for Blizzard's Overwatch player stats. Uses promises.
Blizzard does not expose an official API, so this library relies partially on scraping, using cheerio.
Please also keep in mind there is no builtin rate-limiting support, so it's on you to use the library responsibly.
Note: See CHANGELOG.MD for change details
Features
- Ability to retrieve basic user information, such as name, portrait, level and accounts
- Correctly identifies the platform for each account
- Ability to retrieve detailed stats for a player, for a given region and platform
- Includes all stats available on playoverwatch.com
- Includes the player's current competitive rank
- Includes full list of achievements, with details on which the player has completed
- Stats are retrieved and grouped automatically per career type (quickplay/competitive), hero, and group (e.g combat, awards, etc)
- Supports new heroes and new types of stats as they're added, no changes required to the code
- Supports normalizing names and values (e.g converting achievement names to
snake_case
, properly handling floating-point values in stats, etc) - Minimalist and straightforward API
Usage
Install through npm
:
$ npm install --save oversmash
Example:
import oversmash from 'oversmash'
const ow = oversmash()
ow.player('bob-12345').then(player => {
console.log(player)
})
ow.playerStats('bob-12345', 'pc').then(player => {
console.log(player)
})
oversmash()
options
The following options are configurable.
{
normalizeNames: true,
normalizeNamesAs: 'snake' || 'camel',
normalizeValues: true,
percentsToInts: true,
portraitUrlTemplate: 'https://d1u1mce87gyfbn.cloudfront.net/game/unlocks/%s.png',
defaultPlatform: 'pc',
requestOptions: {
baseURL: 'https://playoverwatch.com/en-us',
headers: {
'User-Agent': 'https://github.com/filp/oversmash (hi jeff)'
}
}
}
requestOptions
are passed directly to request.defaults
on request
Debugging
oversmash
uses debug. Run your code calling oversmash with
DEBUG=oversmash
to enable debug logging
Stuff 🐝 🐝 🐝
See LICENSE.md
for license information
Contributions are welcome - please follow the style guidelines as enforced by the included .eslintrc
!