Skip to content
Advertisement

Data from an Parser is storing 2x the same data instead of 1x some data and the other 1x the other data

I’ve made a parser and it’s supposed to take data from 2 pages in a webshop and save those data but it’s now only saving the data from 1 page two times instead of the data from both the pages each one time. Can someone figure out why only the second page’s data is saved instead of both pages data? output when i run the command and what he is supposed to save what the command is saving

JavaScript

Advertisement

Answer

I think it’s because a mistake here:

JavaScript

You iterate all of parsed pages every time a new page is parsed and compare different links to each other. For example consider your first link is parsed, and you have it in db. Next when you parse the second page, you compare second page date with first one and actually they are different. So you edit every item even page_id. That will change first record in database.

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