miasmos / op.gg-api

Serves op.gg web pages as json.
MIT License
81 stars 21 forks source link

Some returned values are `undefined` #13

Closed lapin-b closed 7 years ago

lapin-b commented 7 years ago

Hi, I'm writing an app for a Discord server but some returned values are undefined. I leave a link to my PrivateBin with the returned response.

As you can see, some values are NaN or undefined.

Reproducing

  1. Require the library like so:
    const opgg = new (require('op.gg-api/client.js'))({
    api_key: process.env.LOLAPIKEY
    });
  2. Then, fetch the API with the library with a specific username
    let summoner_summary = await opgg.Summary('euw', requestedSummoner)
    // Where requestedSummoner is... the requested LoL summoner, i.e. xxpafadelcraftxx
  3. Console.log everything and you should see that some values are undefined or NaN which can be a bit annoying if I want to integrate the API in my application...

Am I doing something wrong or it's a bug on the library side ?

miasmos commented 7 years ago

It is certainly the fault of the library. Unfortunately, this is the nature of scraping. If the DOM structure is changed after implementation, then whatever query will no longer return the expected result. Also, keep in mind that this library is still in alpha. Let me know if you find anything else.