Wikipedia
Wikipedia copied to clipboard
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')