So now it's time to finally go and write our scraping code inside of NodeJS.
After we found out what CSS selector to use inside the Chrome browser.
So now let's first of all, make sure that you're using the URL where all the listings are.
So this URL I have right here.
And let's use that instead of Google.com.
The first thing we need to do is to get the page HTML from Puppeteer.
So how do we do that?
Well, let me show you first.
Let me let me just make this code window a little bigger.
So we're going to say we're going to say just const HTML.
Await page dot content.
That's it.
That's how you get the HTML back from a page using puppeteer.
Now the next thing we need to do is to somehow be able to select the elements or the data that we need,
just like we did inside the console in the browser.
Now, remember, in the beginning of this section, we started importing Puppeteer and a package called
Cerio.
So Cerio is going to enable us to select elements from an HTML page.
So let's import Cheerio up here in the top of the file.
Let's say const cheerio require.
Cheerio.
And then down here again, let's say const, and then we have the dollar sign, just like we had the
dollar sign inside of the Chrome browser.
And then we say Cheerio load, and then we pass in the HTML from the side.
And then cheerio is going to pass or load the HTML that we have from the page and it's going to enable
us to select elements just like we did inside the Chrome browser.
So now we can do the magic trick here where we just take the code that we had from the console inside
the Chrome browser, which was this one here where we get all the job titles.
So I'm just going to select that and copy and paste it in here.
So now we have this code right here and it's going to console log all of the job titles.
And notice how it is using the same dollar sign variable just like we do inside of the browser.
We just created our own dollar sign variable for the jQuery selector using Chario inside of NodeJS.
So now enough talking.
Let's try and run the code and see if it actually prints out all of the job titles, just like it did
inside the Chrome console.
So Node Index.js.
Let's see what happens.
So now it's starting up the browser here.
And it looks like it loaded the page now and then inside the terminal console, I can see all of the
job titles.
So I hope you got to the same point as me right now.
And you're well on your way to becoming a scraping ninja.
Now, of course, we need to get some more properties now.
We also need to get the date it was posted and the job description URL.
So that's what we're going to be looking at in the next section.