Thursday 23 April 2020

Puppeteer crawled product name includes " char (inch), how escape it...

Hello node.js and reddit community.I have one weird issue, at least I think that's whats causing the issue... I'm building an automator which syncs b2b with my ecommerce, and with monitors name it comes to an issue.Here is an example monitors name: Monitor 18.5" Acer V196HQLAb LED VGASo, inside some of the page.evaluate functions, I use:const qs = sel => document.querySelector(sel) const nameRef = "h1.name" const name = qs(nameRef).innerText // name === "Monitor 18.5" Acer V196HQLAb LED VGA" Now this issue only occurs with monitors, and specificaly the name AND specificaly when the bot tries to push the generated product to the MongoDB so I figured it must be where the error occurs.​Any ideas how I can solve this problem? Would something simple like .replaceWith('"', '\"') do the trick?​Thanks!!

Submitted April 23, 2020 at 12:56PM by mmPvEhunter

No comments:

Post a Comment