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

@marshallofsound/call-of-duty-api

v1.2.15

Published

Wrapper for the Call Of Duty API.

Downloads

11

Readme

https://npmjs.org/package/call-of-duty-api https://www.github.com/sponsors/lierrmm https://www.paypal.me/liammm

https://npmjs.org/package/call-of-duty-api

Call Of Duty API Wrapper

Call of Duty Api is a promised based wrapper for the "private" API that Activision use on the callofduty.com website.

This wrapper is written in NodeJS and is publicly available on npm.

Discord

Join the discord: here

Install

npm install call-of-duty-api

Initialize Module

const API = require('call-of-duty-api')();

or

const API = require('call-of-duty-api')({ platform: "battle" });

List of Platforms

  • psn
  • steam
  • xbl
  • battle
  • uno (activision ID)
//How to access
API.platforms.psn

Please note: uno is for looking up via activision ID and this is only supported on a couple of endpoints.

Supported Endpoints for activision ID

  • MWcombatmp
  • MWcombatwz
  • MWmp
  • MWwz
  • MWstats

Login

  • This needs to be your activision account, not your platform login.
 const API = require('call-of-duty-api')();
 API.login("<email>", "<password>").then(<?>).catch(<?>);

Rate limiting

I have implemented axios-rate-limit incase you want to implement your own rate limitting. All you need to do is pass a ratelimit object when initializing the module.

    const API = require('call-of-duty-api')( { platform: 'battle', ratelimit: { maxRequests: 2, perMilliseconds: 1000, maxRPS: 2 } } );

You can find out more about axios-rate-limit here

Get Stats

API.MWstats(<gamertag>, API.platforms.<platform>).then((output) => {
    console.log(output);  
}).catch((err) => {
    console.log(err);
});

Output

{
    title: 'mw',
    platform: 'platform',
    username: 'gamertag',
    mp:
    { lifetime: { all: [Object], mode: [Object] },
    weekly: null,
    level: 0,
    maxLevel: 0,
    levelXpRemainder: 0,
    levelXpGained: 0,
    prestige: 0,
    prestigeId: 0,
    maxPrestige: 0 },
    zombies:
    { lifetime: { all: [Object], mode: {} },
    weekly: { all: [Object], mode: {} } },
    engagement: { timePlayedAll: 440544, seasonPass: 1 } 
}

Example Project

const API = require('call-of-duty-api')({ platform: "battle" });
//I want Warzone Data
API.MWBattleData('Lierrmm#2364').then(data => {
    console.log(data);  // see output
}).catch(err => {
    console.log(err);
});

Output

[ br: { wins: 1,
    kills: 77,
    kdRatio: 1.2833333333333334,       
    downs: 70,
    topTwentyFive: 20,
    topTen: 11,
    contracts: 15,
    revives: 0,
    topFive: 6,
    score: 55600,
    timePlayed: 27169,
    gamesPlayed: 20,
    scorePerMinute: 122.78699988958003,
    cash: 0,
    deaths: 60,
    title: 'br' },
  br_dmz: { wins: 0,
    kills: 9,
    kdRatio: 1.2857142857142858,
    downs: 11,
    topTwentyFive: 0,
    topTen: 0,
    contracts: 2,
    revives: 0,
    topFive: 0,
    score: 4574,
    timePlayed: 1786,
    gamesPlayed: 1,
    scorePerMinute: 153.66181410974244,
    cash: 53,
    deaths: 7,
    title: 'br_dmz' },
  br_all: { wins: 1,
    kills: 86,
    kdRatio: 1.2835820895522387,
    downs: 81,
    topTwentyFive: 20,
    topTen: 11,
    contracts: 17,
    revives: 0,
    topFive: 6,
    score: 60174,
    timePlayed: 28955,
    gamesPlayed: 21,
    scorePerMinute: 124.6914177171473,
    cash: 53,
    deaths: 67,
    title: 'br_all' } ]