maugenst / tabletojson

An npm module for node.js to convert HTML tables to JSON objects
https://www.npmjs.com/package/tabletojson
MIT License
138 stars 38 forks source link

Not getting row values #58

Closed mariohmol closed 4 years ago

mariohmol commented 4 years ago

Hi,

i'm trying to use this to the get thi table values

https://en.wikipedia.org/wiki/COVID-19_pandemic_by_country_and_territory#covid19-container

But doest returns the values of the columns, (coutries), it always returns the same value.. check it out

{ '0': '8,275',
    'Saint Pierre & Miquelon': '290',
    '297,682': '5,058',
    '1,562,673': '[85]' },
  { '0': '8,175',
    'Saint Pierre & Miquelon': '229',
    '297,682': '7,114',
    '1,562,673': '[88]' },

This is the code:

tabletojson.convertUrl(
            'https://en.wikipedia.org/wiki/COVID-19_pandemic_by_country_and_territory',
            function (tablesAsJson) {
                console.log(tablesAsJson[1]);
            }
        );
mariohmol commented 4 years ago

Using this options works:

{useFirstRowForHeadings: true},

Maybe use true as default?

thanks