Giter Club home page Giter Club logo

node-callofduty's Introduction

Metrics

🏆GitHub Trophies

node-callofduty's People

Contributors

ahmad-zahradeen-tahir avatar lierrmm avatar luizfchaves avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-callofduty's Issues

Error: 401 - Unauthorized. Incorrect username or password

Hi,
It seems that the login suddenly returns Error: 401 - Unauthorized. Incorrect username or password although the credentials are working just fine on the website and used to be working just fine until this morning. I get the same error on both v1.3.4 (my current), and v1.3.5 (your latest).
Any ideas?

hello how can i get blackout matches data?

how can i get blackout matches data?

crm/cod/v2/title/bo4/platform/battle/gamer/jutes%2311766/matches/days/7

this link get matches data but only mp data i wanna blackout matches data

Fetching data without being locked in

Hi, how do I fetch my data without being locked in ? My Code looks as following :
`const api = require('call-of-duty-api')();
const user = "Jalapa#2527";

test = () => {
let username = user;
let platform = api.platforms.battle;

api.MWwz(username, platform).then(data => {
    console.log(data);
    return JSON.stringify({
        "error": "nil",
        "response": data
    });
}).catch (err => {
    console.log(err);
    return JSON.stringify({
        "error": err,
        "response": "nil"
    });
});

};
console.log(test());`

Why do I need to be logged in, or does my Error Not Logged In has a different meaning ?

Recent changes in activision

Activision changed player data to private and when I switch my profile to public/all, I get:
Not permitted: not authenticated

api.login is not a function

Used like in documentation:
await api.login(username, password);

The Error is like this:
(node:1116) UnhandledPromiseRejectionWarning: TypeError: api.login is not a function at Object.execute (D:\Code\Bot\commands\codcheck.js:15:23) at module.exports (D:\Code\Bot\events\guild\message.js:11:25) at Client.emit (events.js:315:20) at MessageCreateAction.handle (D:\Code\Bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14) at Object.module.exports [as MESSAGE_CREATE] (D:\Code\Bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (D:\Code\Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31) at WebSocketShard.onPacket (D:\Code\Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22) at WebSocketShard.onMessage (D:\Code\Bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10) at WebSocket.onMessage (D:\Code\Bot\node_modules\ws\lib\event-target.js:132:16) at WebSocket.emit (events.js:315:20) (Use node --trace-warnings ...to show where the warning was created) (node:1116) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:1116) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Empty response after updating to 1.0.26

Hello,

I'm using your API like this :

API = require('call-of-duty-api')({ platform: "uno" }); API.MWwz('chowh1#5932193').then(data => { console.log(data); })

I get an empty response since this morning :

[ br: {}, br_dmz: {}, br_all: {} ]

When i tried to use the API without the new update it has been throwing an error "mode undefined".

Now it's just an empty response :/

"Not permitted: not authenticated"

As of yesterday, for all requests, the endpoint simply returns

{
   "status": "error",
   "data" : {
      "type": "com.activision.mt.common.stdtools.exceptions.NoStackTraceException"
      "message": "Not permitted: not authenticated"
   }
}

Any thoughts on how I can authenticate?

uno

uno is not wroking :/

How to Transfer my activition ID to linked blizzard ID

Hi there,
First of all, a great appreciation for what you have done for such wrap. It provides much convenient for a developer to get the data needed.
Meanwhile, I am facing the issue that I need to get user War Zone match information and I could only get user Activision Id. Is it possible for me to get the linked account Id (which could be directly consumed by your API) from the Activision ID?
To make my question clear, my Activision Id is "Sabrina#6133335" and this is the only thing I could acquire from my customer automatically. However, if I want to use your API, I had to feed it with "SABRINA#11295" which could only be found after I login into my call of duty profile under the linked account.

Last x Days Stats?

I was wondering if you have considering adding a Last x Days Stats, meaning the stats in the last x number of days.. Or in a more simple way, like a Last 7 Days Stats?

Thanks, great API btw!

Not permitted

Hello,

I got an issue, API returns me

{"error":true,"message":"Not permitted: not allowed"}

but I don't know why :/

Player Data - [feature]

Can you guys add an command to get Player data in MW like the opened characters and skins #

error when trying to get bo4 stats

im getting that when trying to get bo4 stats(
yesterday everything works fine
{ "status": "error", "data": { "type": "com.activision.mt.common.stdtools.exceptions.NoStackTraceException", "message": "Not permitted" } }

Rate Limit

Hi Lierrmm, not an issue, but just wondering what is the rate limit after logging in with an activation account, and without logging in? Is it unlimited after logging in? Thanks!

Gulag stats?

tracker.gg seems to be getting gulag stats, at least for single games from the COD API. Could this be a potential added feature?

Cannot read property 'status' of undefined

I've observed instances of the below:

During the reject of API promises the error handling function is being passed in a value of undefined and throws an UnhandledPromiseRejectionWarning.

reject(this.apiErrorHandling(error.response)); // error.response === undefined

109 ...
110 apiErrorHandling(response) {
111        switch (response.status) { // response is undefined and throws the exception below.
112            case 200:
113 ...

Stacktrace:

(node:14926) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'status' of undefined
    at helpers.apiErrorHandling (/repo/node_modules/call-of-duty-api/index.js:111:26)
    at /repo/node_modules/call-of-duty-api/index.js:74:29
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:14926) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

404 - Not found. Incorrect username or platform? Misconfigured privacy settings?

Earlier this month, my code was working

I do a fuzzySearch then grab the information of a single user for example

  • user object below
{
    "platform": "uno",
    "username": "Frenzla#8701238",
    "accountId": "6750249910373225069",
    "avatar": null
}

then pass the username & platform to the API.MWwz(user.username, user.platform) then it would fetch the information of the given user, now i run the same code and it gives me the Error

404 - Not found. Incorrect username or platform? Misconfigured privacy settings?

Am sure you would say maybe the username changed, but am sure it didn't

docs

It would be great if you can provide detailed docs for each endpoint!

Recaptcha error on login

When trying to perform login the following payload is received
{ gameAccountLinked: false, success: false, error: 'recaptcha', token: 'Recaptcha failed.' }

Package error message
401 - Unauthorized. Incorrect username or password.

Credentials have been verified and are correct. 2FA is not enabled on the account neither on Activision or CallOfDuty web page

Cannot read property 'mode' of undefined

TypeError: Cannot read property 'mode' of undefined
    at /home/xx/cod_server/node_modules/call-of-duty-api/index.js:186:41
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

When I try to call:

		API.MWwz(username, apiGame).then(data => {
			console.log(data);  // see output
			return res.status(202).json({
				"error": "nil",
				"response": data
			});
		}).catch (err => {
			console.log(err);
			return res.status(202).json({
				"error": err,
				"response": "nil"
			});
		});

MWAnalysis not working

I get the following when trying to run the MWAnalysis:

{ type: 'com.activision.mt.common.stdtools.exceptions.NoStackTraceException', message: 'Not permitted: not allowed' }

I'm going to assume we don't have access to that correct?

Cold War API ?

Is your feature request related to a problem? Please describe.
no

Describe the solution you'd like
Add support for Cold War!

Cant login "No device id header present"

Today, the api i made can't login with API.login('leanlarroza@****', '').
I made a test and add + data.message after incorrect password message and this go out:
{"message":"TanoLarry: 401 - Unauthorized. Incorrect username or password. No device id header present."}

Mapping guns to in game names?

Right now whenever you make requests for CW using the api call CWmp, in the payload.lifetime.itemData the response is grouped by weapon type and then the weapons result in something like:

ar_standard_t9,
ar_slowhandling_t9,
ar_slowfire_t9
...

Is there a way, either another API request to the call of duty servers to get the in game mapping of these weapons? Like the XM4, Ak47, etc?

Improve documentation

Hi everybody,
I don't know where to get the gamertag.
After call getLoggedInUserInfo method, the username with platform infos found inside getLoggedInUserInfo response not work with MWBattleData method that returns "404 - Not found. Incorrect username or platform? Misconfigured privacy settings?".

Where to get the proper gametag???
Thanks

Cannot read property 'psn' of undefined

I got:
Cannot read property 'psn' of undefined

When I try:
const API = require('call-of-duty-api');
apiGame = API.platforms.psn;
(Same for other platforms)

401 - Unauthorized. Incorrect username or password.

When attempting to use the login API call, I get hit with a 401 exception. I have verified the email and password are correct and allow me to login to the Activision website, but I also noticed I have 2FA enabled on my Activision account. Does 2FA break the API login call and is there currently a workaround?

Thank you for any time and help provided toward this issue.

Rumble mode?

Just wondering, is it possible to get rumble data using the MWwz endpoint? Also MWcombatwz does this give the 20 most recent matches or is it more than that?

Login with 2fa enabled

Is your feature request related to a problem? Please describe.
I cannot login when 2fa is enabled. Is there a way to get this working? Login works with 2fa disabled, but this is not preferable offcourse.

Describe the solution you'd like
I would like to be able to login while 2fa is enabled

Describe alternatives you've considered
Disabling 2fa.

Error: Cannot find module 'call-of-duty-api'

I placed your sample code into an app.js. I am getting the following error. Any ideas?

module.js:549
throw err;
^

Error: Cannot find module 'call-of-duty-api'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (/home/ubuntu/Node-CallOfDuty/app.js:2:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

[403] All Stats endpoints

Hi

I'm experiencing this issue at the moment

"Error: Request failed with status code 403"

I believe the cookie has expired that you've implemented.

let iwStatistics = codAPI.IWStats(playerId, 'psn');
let bo3Statistics = codAPI.BO3Stats(playerId, 'psn');
let wwiiStatistics = codAPI.WWIIStats(playerId, 'psn');
let bo4Statistics = codAPI.BO4Stats(playerId, 'psn');

await Promise.all([
	iwStatistics,
	bo3Statistics,
	wwiiStatistics,
	bo4Statistics,
]);

Error from datastore from calling PSN / XBL Accounts

PSN and Xbox side API, COD have changed they mw API some reasons. because even i tried username from cod.tracker.gg example: ARWannabes as PSN name and returns that same error.

since i dont own COD MW i cant even test with my username see if is api fallback.

{ type: 'com.activision.mt.common.stdtools.exceptions.NoStackTraceException', message: 'Error from datastore' }

What this using is coming from COD API to Discord BOT

So all callout coming from Discord Server Self but only thing that runs is by command and as small preview.

`
if (args[1] === 'mw') {
var plat = args[2];

                if (plat == "" || plat == null) return message.channel.sendMessage("Select platform `psn|xb1`");


                if (plat = "psn") {

                    var username = message.content.split(" ").slice(4).join(" ");

                    if (username == "" || username == null) return message.channel.sendMessage("Enter your Username from that Platform");

                    var urlInput = defaultBaseURL + "crm/cod/v2/title/" + modernwarfare + "/platform/psn/gamer/" + username + "/profile/type/mp"
                    var options = {
                        method: 'get',
                        url: urlInput,
                        headers: {
                            "content-type": "application/json",
                            "User-Agent": userAgent,
                            'Cookie': "is here",
                        }
                    };

                    axios(options).then(body => {
                        console.log(body.data.data);
                        if (body.data.data.message !== "Not permitted: user not found") {
                            let embed = new Discord.RichEmbed();
                            embed.setColor(0x9900FF)
                            embed.setAuthor(dclient.user.username + "#" + dclient.user.discriminator, dclient.user.avatarURL, "")
                            embed.setTitle(message.author.username + "#" + message.author.discriminator + " COD API (Modern Warfare Multiplayer)")
                            embed.setDescription("Your Call of Duty Modern Warfare (Multiplayer)")
                            embed.setThumbnail("https://portforward.com/call-of-duty-modern-warfare/call-of-duty-modern-warfare-logo.png")
                            embed.addField("Level: ", body.data.data.level, inline = true)
                            embed.addField("Prestige: ", body.data.data.prestige, inline = true)
                            embed.addField("Melee Kills: ", body.data.data.lifetime.all.melee, inline = true)
                            embed.addField("Deaths: ", body.data.data.lifetime.all.deaths, inline = true)
                            embed.addField("Kills: ", body.data.data.lifetime.all.kills, inline = true)
                            embed.addField("Total Games Played: ", body.data.data.lifetime.all.gamesPlayed, inline = true)
                            embed.setTimestamp()
                            embed.setFooter("Sent via " + dclient.user.username + " Using COD-API", dclient.user.avatarURL)
                            message.channel.sendMessage({ embed })
                        } else {
                            let embed = new Discord.RichEmbed();
                            embed.setColor(0x9900FF)
                            embed.setAuthor(dclient.user.username + "#" + dclient.user.discriminator, dclient.user.avatarURL, "")
                            embed.setTitle(message.author.username + "#" + message.author.discriminator + " COD API (Modern Warfare Multiplayer)")
                            embed.setDescription("Your Call of Duty Modern Warfare (Multiplayer)")
                            embed.setThumbnail("https://portforward.com/call-of-duty-modern-warfare/call-of-duty-modern-warfare-logo.png")
                            embed.addField("Error: ", "404", inline = true)
                            embed.addField("Message: ", "User not Found? Check if Correct Username you just Entered", inline = true)
                            embed.setTimestamp()
                            embed.setFooter("Sent via " + dclient.user.username + " Using COD-API", dclient.user.avatarURL)
                            message.channel.sendMessage({ embed })
                        }
                    }).catch(err => console.log(err));

                } else if (plat = "xb1") {

                    var username = message.content.split(" ").slice(4).join(" ");

                    if (username == "" || username == null) return message.channel.sendMessage("Enter your Username from that Platform");

                    var urlInput = defaultBaseURL + "crm/cod/v2/title/" + modernwarfare + "/platform/xb1/gamer/" + username + "/profile/type/mp"
                    var options = {
                        method: 'get',
                        url: urlInput,
                        headers: {
                            "content-type": "application/json",
                            "User-Agent": userAgent,
                            'Cookie': "is here",
                        }
                    };

                    axios(options).then(body => {
                        //console.log(body.data.data);
                        if (body.data.data.message !== "Not permitted: user not found") {
                            let embed = new Discord.RichEmbed();
                            embed.setColor(0x9900FF)
                            embed.setAuthor(dclient.user.username + "#" + dclient.user.discriminator, dclient.user.avatarURL, "")
                            embed.setTitle(message.author.username + "#" + message.author.discriminator + " COD API (Modern Warfare Multiplayer)")
                            embed.setDescription("Your Call of Duty Modern Warfare (Multiplayer)")
                            embed.setThumbnail("https://portforward.com/call-of-duty-modern-warfare/call-of-duty-modern-warfare-logo.png")
                            embed.addField("Level: ", body.data.data.level, inline = true)
                            embed.addField("Prestige: ", body.data.data.prestige, inline = true)
                            embed.addField("Melee Kills: ", body.data.data.lifetime.all.melee, inline = true)
                            embed.addField("Deaths: ", body.data.data.lifetime.all.deaths, inline = true)
                            embed.addField("Kills: ", body.data.data.lifetime.all.kills, inline = true)
                            embed.addField("Total Games Played: ", body.data.data.lifetime.all.gamesPlayed, inline = true)
                            embed.setTimestamp()
                            embed.setFooter("Sent via " + dclient.user.username + " Using COD-API", dclient.user.avatarURL)
                            message.channel.sendMessage({ embed })
                        } else {
                            let embed = new Discord.RichEmbed();
                            embed.setColor(0x9900FF)
                            embed.setAuthor(dclient.user.username + "#" + dclient.user.discriminator, dclient.user.avatarURL, "")
                            embed.setTitle(message.author.username + "#" + message.author.discriminator + " COD API (Modern Warfare Multiplayer)")
                            embed.setDescription("Your Call of Duty Modern Warfare (Multiplayer)")
                            embed.setThumbnail("https://portforward.com/call-of-duty-modern-warfare/call-of-duty-modern-warfare-logo.png")
                            embed.addField("Error: ", "404", inline = true)
                            embed.addField("Message: ", "User not Found? Check if Correct Username you just Entered", inline = true)
                            embed.setTimestamp()
                            embed.setFooter("Sent via " + dclient.user.username + " Using COD-API", dclient.user.avatarURL)
                            message.channel.sendMessage({ embed })
                        }
                    }).catch(err => console.log(err));

                }
                /*else if (plat = "pc") {

                                   var username = message.content.split(" ")[3].replace(/#/gmi, "%23");;
                                   username = username.replace(/([\w\W]*)%23\d+/gmi, '$1');
                                   console.log(username)

                                   if (username == "" || username == null) return message.channel.sendMessage("Enter your Username from that Platform");

                                   var urlInput = defaultBaseURL + "crm/cod/v2/title/" + modernwarfare + "/platform/battle/gamer/" + username + "/profile/type/mp"
                                   var options = {
                                       method: 'get',
                                       url: urlInput,
                                       headers: {
                                           "content-type": "application/json",
                                           "User-Agent": userAgent,
                                           'Cookie': "is here",
                                       }
                                   };

                                   axios(options).then(body => {
                                       //console.log(body.data.data);
                                       let embed = new Discord.RichEmbed();
                                       embed.setColor(0x9900FF)
                                       embed.setAuthor(dclient.user.username + "#" + dclient.user.discriminator, dclient.user.avatarURL, "")
                                       embed.setTitle(message.author.username + "#" + message.author.discriminator + " COD API (Modern Warfare Multiplayer)")
                                       embed.setDescription("Your Call of Duty Modern Warfare (Multiplayer)")
                                           //embed.setThumbnail(user.avatarURL)
                                       embed.addField("Level: ", body.data.data.level, inline = true)
                                       embed.addField("Prestige: ", body.data.data.prestige, inline = true)
                                       embed.addField("Melee Kills: ", body.data.data.lifetime.all.melee, inline = true)
                                       embed.addField("Deaths: ", body.data.data.lifetime.all.deaths, inline = true)
                                       embed.addField("Kills: ", body.data.data.lifetime.all.kills, inline = true)
                                       embed.addField("Total Games Played: ", body.data.data.lifetime.all.gamesPlayed, inline = true)
                                       embed.setTimestamp()
                                       embed.setFooter("Sent via " + dclient.user.username + " Using COD-API", dclient.user.avatarURL)
                                       message.channel.sendMessage({ embed })
                                   }).catch(err => console.log(err));

                               }*/
                else {
                    message.channel.sendMessage("You never Selected right Platform, Please Select `psn|xb1`")
                }
            }

`

i only took bit of code from your LIB since your LIB wasn't even happy with discord LIB.

but everything works fine just cod MW some how has failed datastore background on error so im not sure they disabled API or not.

but i disable that command for now till i get response back.

API issues?

I sent a ton of requests and got rate limited, but its been active for over 12 hours now which is not normal in my experience. Also noticed I can't get data at my.callofduty.com. Are you / anyone else noticing issues?

(This was the best spot I could think to reach out, it might be good to setup a discord server for people to hang out in to discuss these kinds of things)

Login failing

Hello:

i know is difficult to find the workaround to make the login to work, currently on version 2.1.1 i am getting:
We Could not get a valid reason for a failure. Status: TimeoutError: Navigation timeout of 30000 ms exceeded
finished
but now sure if its because the user i am using or maybe because the recaptcha can't be bypassed by the pupetter module.
thanks.

Match Details Endpoints

Feature Request: match details from a specific match ie: warzone lobby (multiplayer lobbies, cold war zombie lobbies if possible)

I would like to hopefully have a solution that provides details on teams, who was in each team, and their stats for that match. see link1 where you can view match history and load the scoreboard from the specific match.

Describe alternatives you've considered
please see link2 for reference.

Additional context

link1: https://my.callofduty.com/player/match-history (Requires Account Login)

  If you view network details via your browser it calles the following: 
https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/battle/gamer/<BATTLETAG>/profile/type/wz

link2: https://documenter.getpostman.com/view/5519582/SzzgAefq#05aa7341-d67b-4b1b-af6d-e4392baaf3cd

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.