Error using page() to get infobox()
Do you have any thoughts on what Invalid attempt to destructure non-iterable instance is referring to in this context?
/PROJECTS/research/node_modules/wikipedia/dist/page.js:256
throw new errors_1.infoboxError(error);
^
infoboxError: infoboxError: TypeError: Invalid attempt to destructure non-iterable instance
at Page.infobox (/PROJECTS/research/node_modules/wikipedia/dist/page.js:256:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: undefined
}
Node.js v18.16.0
The code:
const wiki = require('wikipedia')
let page, infobox
async function getPage(input) {
try {
page = await wiki.page(input)
infobox = await page.infobox()
console.log(infobox)
} catch (error) {
console.log(error)
}
return infobox
}
getPage('John M. Vining')
Can you mention which page you faced this issue in? I think it might be a problem with https://www.npmjs.com/package/infobox-parser but we would need the page name to confirm @kingram6865
This is the page that I was attempting to parse: https://en.wikipedia.org/wiki/John_Vining
I think it's possible you need to account for the case where there is no Infobox.
Also I think the page that is use case for my error example may have been corrected since this issue was created.
You close this issue? It's not fixed. You asked me about a page when all you have to do is run the example code I put in my comment to see the results. I told you what the likely problem is.