dijs / wiki

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

v4.11.0: Tables function fails #98

Closed divanvb closed 5 years ago

divanvb commented 5 years ago

Hi

The tables function fails for the following page

wiki({apiUrl: 'https://cod-esports.gamepedia.com/api.php'}).page('OpTic Gaming')

Error:

(node:44786) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'start' ofundefined at start (/Server/node_modules/infobox-parser/util/parseTables.js:63:41) at Array.map () at map (/Server/node_modules/infobox-parser/util/parseTables.js:60:21) at getTables (/Server/node_modules/infobox-parser/util/parseTables.js:81:17) at parseTables (/Server/node_modules/infobox-parser/index.js:35:15) at */Server/node_modules/wikijs/src/page.js:270:22 at process._tickCallback (internal/process/next_tick.js:68:7) (node:44786) 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(). (rejection id: 1) (node:44786) [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.

EDIT: The function also brings back an empty array for the following page: wiki({apiUrl: 'https://cod-esports.gamepedia.com/api.php'}).page('Category:North_American_Teams')

divanvb commented 5 years ago

Making a comment in case it fell off your radar again.

dijs commented 5 years ago

Nope, fixing it now.

dijs commented 5 years ago

I fixed the parsing error (have not published yet). But the second issue is going to be harder to tackle. Since that page is made with templates. I have not figured out a general solution to those yet.

dijs commented 5 years ago

Published in v4.11.1

divanvb commented 5 years ago

Ah okay cool thanks, will have a look and get back to you. Yeah I also noticed it uses templates so at the moment I'm scraping that data manually with a different module but would like to have only use one module for everything. Will be keeping an eye out for an implementation once you manage to figure out a general solution!

dijs commented 5 years ago

What is the other module you are using?

divanvb commented 5 years ago

I'm using scrape-it to manually scrape HTML from the page.