Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using page() to get infobox() #53

Closed
kingram6865 opened this issue Jul 3, 2023 · 4 comments
Closed

Error using page() to get infobox() #53

kingram6865 opened this issue Jul 3, 2023 · 4 comments

Comments

@kingram6865
Copy link

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')
@dopecodez
Copy link
Owner

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

@kingram6865
Copy link
Author

This is the page that I was attempting to parse: https://en.wikipedia.org/wiki/John_Vining

@kingram6865
Copy link
Author

kingram6865 commented Jan 27, 2024

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.

@kingram6865
Copy link
Author

kingram6865 commented May 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants