So right now we are able to scrape the job titles and the job URLs from the first page.
But how do we go about scraping all the other pages as well?
It's quite simple actually.
You just have to create a loop that changes the page number and the URL up here for the URL.
So let's try and see if we can make a simple for loop here.
So we say four and we say, let I be equal to one because it starts from page one, not from page zero.
And then we go up until page 14.
And then let's put all of our code inside of the loop here.
And then let's make sure that we use this I variable inside of the URL.
So I'm going to replace these, uh, quotes with a backtick.
So we can just put the variable inside of the string like this by having a dollar sign and curly brace.
Then let's put the I inside here.
So that's it.
Basically, now we are scraping all of the different pages on the site.
Now, since we want to make a big array for all of the charts and not just a single page, let's create
an empty array outside of the scope of the for loop.
So let's call it all chops, and it's just initialize an empty array here.
And then at the end of the loop, let's push the page data onto this array.
So we can say all shops dot push.
And then I'm going to use the spread operator to just copy the array into this existing array, or push
it at the end of the array.
At the end of the loop.
Let's try and do a console log with all chops dot length.
It should be around 325 items we get in this.
Now let's try and run the code and see what we get.
And we can see we get 325.
So that means we do get all of the jobs from every of the 14 pages.
Okay, so now we got all of the pages with all of the job titles and the URLs.
But what about the job descriptions that we have when we click on the job?
We also want to get all of this text here.
So how can we get those and traverse even further into the site.
Let's dig into that in the next section.