Okay, So now we were able to get the company name and all we need to do now to get the contact column
and the contact column is just to do the same thing we have here just with a different index instead.
So let's just copy this line here and paste it down two times below and change the index to one and
we change the variable name to be contact instead.
And down here we change it to be two and change it to be country instead.
So then it fits with the table.
And now we need to put all of the results.
For every row we have a object we create, let's call it const and let's call it scraped.
Row.
And let's say that it is this object here with the company contact and country.
And we save that.
And then we need to save it into an array that we declare up here before we begin the loop.
So up here we can declare an array we call const scraped rows, just an empty array.
And then for each row we just push this scraped object into the array.
So scraped rows.
Third push.
Scrape row.
Now, once the loop has finished, we can try to do a console log to see how the array is looking like.
Console log scraped rows.
Let's save that and let's try to run it inside Node JS.
Node Index.js.
And here we go.
So now we can see all of the table data.
You can see the first row here has empty data inside of it because it has the element instead.
But we're going to fix that in just a moment.
But as you can see, we have all the other rows here with the company, contact and country correctly
declared.
Let's try and skip the first row we have on top so we don't have this empty object here.
So we can say if the index equals zero.
So that's the first row we have up here with the elements.
If that's is the case, if that's the case, then we just say return true.
So then then we skip this this iteration of the each loop, this, this row.
We skip that.
So now let's try and run it again and see what happens here.
So now we have all of the rows, but without the empty data at the first row.
Okay, so that's it.
That's how we we find out how to build a selector with chrome tools and how to make sure it works inside
Chrome tools and then how to transfer that into NodeJS.
So now that we have it inside of NodeJS, we can build an API, we can deploy a periodic scraper that
we can make, so we can make it scrape a page at every hour, every day, every week or however however
we want to do it.
And so now we can scrape websites without having a browser open and pasting pasting in code every time.
And we can save the data to a database in MongoDB or save it to a CSV file and so on.
So I hope you enjoyed this section and if there's any questions or if you're stuck with anything, let
me know.