Giter Site home page Giter Site logo

gclem / overwatch-js Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 9.0 92 KB

Overwatch NodeJS API : Retrieve informations about heroes/players from Overwatch Official Website

License: MIT License

JavaScript 100.00%
overwatch overwatch-api nodejs npm overwatch-js deprecated

overwatch-js's People

Contributors

dfsoeten avatar gclem avatar lanacoyote avatar wintercore 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

Watchers

 avatar  avatar  avatar

overwatch-js's Issues

How to catch information...

I want to create a Discord bot that show you your overwatch profile.
I know everythings I need to know, exept HOW TO CATCH INFORMATION FROM THE CONSOLE (Like player level or rank)
How to do it ?
Thanks !!
Edorion

TypeError when using getOverall()

Hey!

I've been using your library for a while, but since the 29th of september its broken. It breaks on the getOverall() method giving the following error:

Unhandled rejection TypeError: Cannot read property 'NaN' of undefined at parseProfile (/Users/daan/NodeJS/freewingiveawaybot/node_modules/overwatch-js/lib/overwatch.js:154:66) at Promise (/Users/daan/NodeJS/freewingiveawaybot/node_modules/overwatch-js/lib/overwatch.js:282:34) at new Promise (<anonymous>) at rp.then (/Users/daan/NodeJS/freewingiveawaybot/node_modules/overwatch-js/lib/overwatch.js:281:21) at tryCatcher (/Users/daan/NodeJS/freewingiveawaybot/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/daan/NodeJS/freewingiveawaybot/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/Users/daan/NodeJS/freewingiveawaybot/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (/Users/daan/NodeJS/freewingiveawaybot/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/Users/daan/NodeJS/freewingiveawaybot/node_modules/bluebird/js/release/promise.js:693:18) at Async._drainQueue (/Users/daan/NodeJS/freewingiveawaybot/node_modules/bluebird/js/release/async.js:133:16) at Async._drainQueues (/Users/daan/NodeJS/freewingiveawaybot/node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues (/Users/daan/NodeJS/freewingiveawaybot/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:696:18) at tryOnImmediate (timers.js:667:5) at processImmediate (timers.js:649:5)

If you could take a look at it that would be great, otherwise let me know if I need to dig in to fix it!

Rank is undefined

I found the solution about my last problem, but now when I want the player rank (data.profile.rank)
It return undefined.
But if I search for data.profile.level or data.profile.avatar It work...
HELP !!

Recent playoverwatch.com changes

The website has been changed a bit recently:

  • There are no more region based statistics; all region based URLs are redirected to the same profile now
  • Searching accounts apparently now supports multiple results, and apparently you can use https://playoverwatch.com/en-us/search/account-by-name/<name> as a JSON endpoint directly

Maybe there are some more changes, but this is all I know of.

profile.rank is returning NaN for any player

profile.rank is returning NaN for any player, ranked or not in current season.
On last sunday, playoverwatch.com was returning error for any profile, and when it came back, this error showed. Maybe some issue in html parse ?

Platform and Region values are not correct when using .search()

Using

API.search("Mielophone-2188");

Returns the following

{
    "careerLink": "/career/pc/eu/Mielophone-2188",
    "platformDisplayName": "Mielophone#2188",
    "level": 83,
    "portrait": "https://blzgdapipro-a.akamaihd.net/game/unlocks/0x0250000000000BAF.png",
    "platform": "career",
    "region": "pc",
    "tier": 14
}

As you can see the platform and region property values are not correct

overwatch.js

self.search = (username) => {
    var options = {
        uri: getSearchUrl(username),
        json: true
    };

    return rp(options).then((datas) => {
        _.each(datas, (player) => {
            var i = player.careerLink.split('/');
            player.platform = i[1];
            player.region = i[2];
            player.tier = (player.level - player.level % 100) / 100;
            player.level = player.level % 100;
        });

        return datas;
    })
        .catch(handle);
}

should be

self.search = (username) => {
    var options = {
        uri: getSearchUrl(username),
        json: true
    };

    return rp(options).then((datas) => {
        _.each(datas, (player) => {
            var i = player.careerLink.split('/');
            player.platform = i[2];
            player.region = i[3];
            player.tier = (player.level - player.level % 100) / 100;
            player.level = player.level % 100;
        });

        return datas;
    })
        .catch(handle);
}

PROFILE_NOT_FOUND

owjs
    .getAll('xbl', 'us', 'Golden Wolf833')
    .then((data) => console.dir(data, {depth : 2, colors : true}) );

Returns the error "PROFILE_NOT_FOUND"

Overwatch-js is completely broken

My bot I was working on a long time ago dont work anymore.
I tried to fix it, but (as you can see), the api is returning slightly less data than before :

{ profile:
   { nick: 'Speedy',
     level: 31,
     avatar:
      'https://d15f34w2p8l1cc.cloudfront.net/overwatch/600a5cc024fa3daeca4eb397e5fcec66417a12ef47e2920dba1f835c25a7096c.png',
     rank: NaN,
     tier: '',
     platform: '',
     url: 'https://playoverwatch.com/en-us/career/pc/eu/Speedy-23165' },
  competitive:
   { global: { masteringHeroe: undefined },
     heroes: { competitive: {} } },
  quickplay:
   { global: { masteringHeroe: undefined },
     heroes: { quickplay: {} } },
  achievements: [] }

Any idea ?
Maybe should I use another api (sadly, because this is the best one), or maybe an update is required...
Thanks

Hosting

Hi,

I'll make some Overwatch API nodes available for public use, surely with quotas except for contributors.

If anyone has needs, let me know.

returns a split() error when i try and use owjs.search()

The search function suddenly started returning an error when trying to use it. I narrowed it down to this part of the source code- overwatch.js:317. It is trying to split player.careerLink even though player.careerLink is undefined. player doesn't contain a careerLink object.

Node versions > 6

Hey there!

I noticed that I cannot use overwatch-js with any Node version above 6. I suppose it's compatible with higher versions, but I haven't fully tested it. Can you take a look at

"engines": {
  "node": "6.0.0"
},

inside package.json and support higher versions?

weird character names

names with weird characters don't work like SĔNPAI-1698 if you want to get the data you need todo S%C4%94NPAI-1698

Ranking !== Rank

There's a mismatch between the SR that the API calls and the "rank" that it lists (i.e. Silver, Diamond, Master...)

Examples I can call upon are as follows:

My Account reads 3040 SR but displays the rank as Master, when it should be Diamond.
A friend's account reads 2772 SR, ranks Diamond. Should be Platinum.
A friend's alt ranks 2588 SR, ranks Diamond. Should be Platinum.
A random account I scraped off of BattleNet had an SR of 734, and classed as Gold. THIS IS BRONZE.

Clearly there's some kind of issue with how the API interprets the ranking. It's probably a simple fix.

Question: Search for player with GetAll

How do you search for a player with GetAll.

I'm trying to attach this to discord but I need it to search for the player while also getting all their stats.

Cannot read property 'replace' of undefined

Good evening,

I was trying to use Overwatch.getAll('pc', 'eu', 'TheDarangel#2161') when I faced this error:

TypeError: Cannot read property 'replace' of undefined
    at parseProfile (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\overwatch-js\lib\overwatch.js:148:65)
    at Promise (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\overwatch-js\lib\overwatch.js:262:34)
    at new Promise (<anonymous>)
    at rp.then (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\overwatch-js\lib\overwatch.js:261:21)
    at tryCatcher (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (C:\Users\TheDarangel\Desktop\nspire-ow-bot\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:773:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate [as _immediateCallback] (timers.js:711:5)

Here is the career link: /career/pc/TheDarangel-2161

This may be related to the fact this career got two player-level divs ?

Heroes object does not contain anything

When I try to get hero information, I get an empty object.

This is what I've attempted to do:

console.log(data.quickplay.heroes);

returns {}

Alternatively, when I do:

console.log(data.quickplay.heroes.roadhog);

returns undefined

Structure change

I've been writing a module of my own similar to this one and I've noticed that the structure has changed in a few subtle ways. For example the old season 1 and 2 ranks are no longer in the page. 2) time played table field is now true time_played down to the second which is awesome.

However it's also been reporting strange numbers for damage_done fields for some players, some of the time. Right now for example, some players' heroes will display the same number for both hero_damage_done and hero_damage_done_most_in_game.

I suspect the overwatch web dev team are doing some work to move over to their new API that launched last week. If I'm right, these changes will likely continue for some time and we may even see the frontend completely rewritten.

Hopefully Blizzard decides to share their shiny new overwatch API with the public, and we don't need to resort to this awful scraping junk. :D

Thought you'd like to know ;)

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.