Skip to content

Conversation

@nickmorri
Copy link
Contributor

Summary

Catch JSON.parse error to allow other valid JSON-LD and Open Graph data on the page to be parsed.

Reproduction Steps

Retrieve https://aersf.com/products/pro-kit.

Changes

  • Added JSONLDOptions to OpenGraphScraperOptions
  • Changed default behavior when JSON.parse errors are encountered
  • Added new test cases

Closes #257

… change default behavior to not throw on JSON-LD string parse errors
@nickmorri nickmorri force-pushed the nickmorri/handle-invalid-json-parsing branch from 52ff9e1 to f7bc443 Compare January 18, 2025 00:52
@jshemas
Copy link
Owner

jshemas commented Jan 18, 2025

Can you fix the eslint errors and add JSONLDOptions to the readme?

@nickmorri
Copy link
Contributor Author

@jshemas done!

@jshemas
Copy link
Owner

jshemas commented Jan 19, 2025

Thank you for the pull request.

@jshemas jshemas merged commit 8380c04 into jshemas:master Jan 19, 2025
4 checks passed
@jshemas
Copy link
Owner

jshemas commented Jan 19, 2025

Changes are live in open-graph-scraper@6.9.0

@nickmorri
Copy link
Contributor Author

Thanks for the speedy review and release!

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

Successfully merging this pull request may close these issues.

JSON parsing error thrown on invalid JSON-LD

2 participants