Skip to content
Advertisement

Node.js web Scraper running function multiple times. I only want it to run once

I am attempting to write ${car}, ${link}, ${price} to a csv file. My current code does that but it runs my functions more then once and I end up with ${car}, ${link} and ${price} 5 separate times in my csv file I only want it once. Any help would be much appreciated! Thank you in advance!

JavaScript

just for reference this is what I would like my csv file to look like

Target CSV file out come

Advertisement

Answer

According to the DOM structure of this specific website, this is what worked on my end.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement