Hi all,So I have this program I'm making, where it scrapes a site and returns a product image, title, and url.The npm package I'm using for this puppeteer, (by google) but the issue is that puppeteer scrapes data by CSS selectors, and the product image selector is completely separate from the product title and url selector.Because of this, I need to first scrape for the title/url, push that to an array, and then scrape for the images and put that into the same arrray. But the output JSON ends up being like so:[{ title: "foo", url: "foo"}, <--- multiply this by like 10 products{productImageURL: "foo"},{productImageURL: "foo"},{productImageURL: "foo"},{productImageURL: "foo"}]instead, I want it like so:[{ title: "foo", url: "foo", productImageURL: "foo"},etc...]is this even possible? My code is linked here, I can't figure out for the life of me how I would possibly do that.
Submitted August 02, 2018 at 10:35PM by d-a-v-i-d-
No comments:
Post a Comment