dijs / wiki

Wikipedia Interface for Node.js
MIT License
315 stars 61 forks source link

call to page.tables() returns undefined #142

Closed osaaoui closed 3 years ago

osaaoui commented 4 years ago

Hi, starting today I 'm having a 500 server error caused by a call to page.tables() that returns undefined. this is the call: wiki() .page("COVID-19_pandemic_in_Algeria") .then((page) => page.tables()) .then(console.log);

and this is the results I got: [ [ { province: 'Blida\n |1 March 2020\n |1372\n |128\n |133',
firstCase: undefined, confirmedCases: undefined, deaths: undefined, recoveries: undefined }, { province: 'Algiers\n |13 March 2020\n |1212\n |143\n |261',
firstCase: undefined, confirmedCases: undefined, deaths: undefined, recoveries: undefined }, ...etc

just a few days ago, the api call worked fine. Thanks, OS

dijs commented 3 years ago

I don't know what changed, but this seems to be working better now. Still some formatting to handle though. I will try to get out a release which fixes those.

[
  [
    {
      province: 'Algiers',
      firstCase: '13 March 2020',
      confirmedCases: '{{formatnum:6506}}',
      deaths: '145',
      recoveries: '261'
    },
    {
      province: 'Blida',
      firstCase: '1 March 2020',
      confirmedCases: '{{formatnum:4435}}',
      deaths: '131',
      recoveries: '133'
    },
    {
      province: 'Oran',
      firstCase: '21 March 2020',
      confirmedCases: '{{formatnum:4248}}',
      deaths: '22',
      recoveries: '234'
    },
    {
      province: 'Sétif',
      firstCase: '19 March 2020',
      confirmedCases: '{{formatnum:3408}}',
      deaths: '61',
      recoveries: '2'
    },
dijs commented 3 years ago

I just pushed a big update to table parsing with v6.2.0, please give it a whirl.