So now it's time for us to actually start out writing the parser so we can get our test passing and.
Remember from the first original Craigslist tutorial that we found out all of the info that we wanted
is inside this result info element.
So we have the result info.
And in here there's the date and the title and the URL and also the neighborhood.
So if we go and select the result info class here, we should be able to get some info for all these
listings.
First, let's write out the listings function here where we take in the HTML.
And then we define this dollar sign or jQuery variable using Cheerio load HTML so we can select all
of the elements.
So then we can say dollar sign and pass in this result info.
And now since the result info is a CSS class, we need to put a dot in front of it to select it in jQuery.
And then we can say dot map where we have a index and then the element.
So that's going to map over each of these elements we have on this page.
And well, also, let's define a variable here, which is called listings.
Actually we can just say return here.
And then also remember to have Dot get at the end of this map of this map call and dot get simply means
that we need to get this array of elements that we have been mapping over through.
Now back to getting the title.
So result info.
That's the elements we're getting.
And then we need to find this child element, which is called result title and header link.
So the the CSS class which resolved title and header link, we need to extract that from this result
info.
So the way to do that is we can say const title equals then the dollar sign and then we pass in this
element we currently have and we find the element or the child element that has the class of this one.
And remember, since it's CSS classes, we need to have dots in front of them.
Just like that.
And then we can simply say dot text because it's just the text contents of this, this element that
is the title.
And then we have the title and then we can say return.
Title.
Now let's see how it looks.
Okay, we already have two test that is passed, and that's probably the the one for the title and the
one for getting the length of the listings because now we already have a 120 elements in this array
and but they don't have all the properties.
But we have 120 elements in the listings array and we also have the titles for the first element.