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: Unexpected token x in JSON at position 207 #234

Closed
yeouchien opened this issue Jul 22, 2024 · 2 comments · Fixed by #235
Closed

error: Unexpected token x in JSON at position 207 #234

yeouchien opened this issue Jul 22, 2024 · 2 comments · Fixed by #235

Comments

@yeouchien
Copy link

url: https://www.youtube.com/watch?v=nFbKMg4E3JM

{
  error: true,
  result: {
    success: false,
    requestUrl: 'https://www.youtube.com/watch?v=nFbKMg4E3JM',
    error: 'Unexpected token x in JSON at position 207',
    errorDetails: SyntaxError: Unexpected token x in JSON at position 207
        at JSON.parse (<anonymous>)
        at t.<anonymous> (/.../node_modules/open-graph-scraper/dist/esm/lib/extract.js:102:47)
        at m.BOr (/node_modules/cheerio/lib/api/api/traversing.ts:581:24)
        at Jjr (/.../node_modules/open-graph-scraper/dist/esm/lib/extract.js:96:21)
        at vnn (/.../node_modules/open-graph-scraper/dist/esm/lib/openGraphScraper.js:41:40)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at WAt (/.../node_modules/open-graph-scraper/dist/esm/index.js:27:19)
        at lwn (/.../src/index.ts:97:17)
        at Runtime.handler (/node_modules/src/awslambda.ts:331:1)
  },
  response: undefined,
  html: undefined
}

i think this is a bug from #214 and works after downgrade to 6.4.0

@jshemas
Copy link
Owner

jshemas commented Jul 22, 2024

Thanks for letting me know, I have not seen this issue before!

jshemas added a commit that referenced this issue Jul 22, 2024
fix: JSON parsing fails when Youtube escape '&' to '\x26' (#234)
@jshemas
Copy link
Owner

jshemas commented Jul 22, 2024

Changes are live in open-graph-scraper@6.7.0. Please let me know if you have any more problems.

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 a pull request may close this issue.

2 participants