Now let's try and see first if jQuery is enabled on this page.
So we go inside of the console, inside of the Chrome developer tools and we can see something comes
up when I press the dollar sign, which means that jQuery is on the page.
Remember that every shop had this result info class inside of this p element.
Well, we can see when we write result info the selector for result info we get 120 elements, which
means we get all of the jobs on the page.
So that's great.
Now let's try, try.
Let's just try and go inside of the result info element.
We see.
We have a H element which has the link.
And the title of the job.
So maybe if we try and get the the header link class or the result title class, we can get all of the
job titles.
Let's try and do that.
So we go through each of the result info elements.
We make a each loop here, which has a index and an element, and the element is then each of the job
titles.
So if we write console.log dollar sign and have my element in here and then I can do a selector like
find or children, I'm going to use children now and I will select all the children which has the class
of result title.
And that's going to get me the title of every job.
You here we have the result info class for every job.
And then inside there's a h element which has the class of result title and we can use that to get the
job title.
And now I just need to figure out what where I'm missing my parent pieces here.
So hold on a moment.
I just need to figure out where it's missing.
There's a lot of parenthesis, so hang in there, but we'll figure it out.
Okay.
Yeah.
I missed one at the end here.
And we get all of the job titles now.
So.
And now we can basically just paste this code that we made inside of the Chrome console inside of our
NodeJS project.
Let me show you how that works.
We just select all of this.
And then I can paste it inside of my NodeJS project.
Like so.
And you can notice we're using the dollar sign that we defined using Jerry load, which then gives us
the opportunity to just copy paste code from the Chrome console, which is also using the dollar sign
to select elements using jQuery.
And you will see we get exactly the same output as we did inside of Chrome console.
So we write run the Index.js file using node index.js.
And we should see the exact same output as inside Chrome console.
There you go.
Okay, last thing I'm going to do, I think I will just make a variable called title.
So we'll say const title instead of having a console log like that.
So now let's try and get the URL for the job where we can read the description.
You can see that inside of the H element, which has the href attribute as you call it, which has the
URL for the job.
So let's make a variable for just the title and then we can select the title and the URL.
Let me show you what I mean.
So let's call it result title and put in the element itself in here.
Then from the result title, I can just say dot text to get the title of the job and to get the URL
of the job.
I'd say attribute href and this is exactly the same as if I was using jQuery, of course.
Um, so if you're familiar with jQuery, this should be really familiar to you.
Then I think I want to put this inside of our object.
They say, like the sample object we defined before.
I would just call it scrape, assault.
And this up here, I call scrape, sample.
And and here we put in the title and the URL.
And now we'll define an array where I put in all of my different scrape results, which is the different
jobs, and I will just push the result onto here.
And then in the end, we can also try and do a console log of our array with all the jobs to see how
it looks like.
Hey, let's try and run it.
Node Index.js.
And we can see there's a pretty array coming up with lots of objects, which has a title and a URL for
the job.
So now we just need to add more properties to these scraped results.