Expat expressions hello, everyone.
Today we're going to write some code, and as you can see, I'm already inside our terminal and also
have opened the atrium ID in the background.
So today we're going to scrap it and we're going to write some expat expressions which are the most
commonly used by scrap.
And so today, guys, I will show you how to install this crap inside your computer.
So the first thing I do here with Secretary Gates is to write the forward comment, Scrappy Start Project
Tutorial.
And you can see that immediately after a directory is created inside our section for folder, as you
can see here.
And if I open it, you can see that it is not an empty folder.
So it has already some items here.
And you can see that it has items, pipelines, setters, middleware and so on.
So in that way, by simply typing in the terminal scrub start project tutorial, this will simply launch
of Turrill that you can run from your computer.
And you can see that if you open some of the files that are already populated with the code and you
can see that we have here at different functions, different pipelines and the setting because the settings
as well here.
So this is simply a simple example project of scrappier that you can see in front of you.
So inside this folder, guys, let's actually create our first spider.
So I will select here in spiders, as you can see, I will select new python file and I will simply
write quotes, underscore spider, dot, pua.
OK, and after that, let's write our first script, Spider.
So I will do import scrapie and then let's write let's create a class action.
So Class Kobolds Spider and then inciter right scrapie dot spider.
Let's write a column and then name equals actually get a little bit closer.
So name equals quotes.
And, you know, create a function, so let's write Deve Start requests, OK, and then self.
OK.
And just under.
All right.
Euros equal and let's write some euros here.
So I would htp and the first euro will be quotes.
Dot, dos, scrub.
OK, dot com slash page slash one.
That's it.
And after that this extraordinary URL htp double those quotes dot to scrap dot com slash page two.
OK.
The is here, let's write a comma and let's leave the brackets close here, and after that I will create
a follow.
So let's create four euro in euros, OK, Eells.
Mm hmm.
And then scrapie that request and then I will write euro will be equal to Yorio and then call back equals
self not pass.
OK.
And after that, let's just follow up and I'll create another function.
So let's try to D.F. pass.
And here we have self.
Response.
OK, and the list, right page equals.
Response, that URL.
Don't split, and here, let's write a slash and then minus two.
OK, then, that's right.
File name.
Equals, to, quote, slash percent is not HMO.
That's it, and then percent page.
And then let's write with Open.
File name.
Colma.
WB.
US of.
OK, and then if that's right.
A response, not a body.
OK, and here finally, I will write self log and said, look, I'll write saved file.
Is.
There is one percent file name.
OK, so let's go up, because I noticed there is a slight typo here.
So here is Kuruppu.
OK, that's it, and let's save this file, guys.
So while the file was saved, now we can actually run it.
And as you can see here, what we actually created, we saw obviously with the spiders we created the
internal request the scrapie will make to the websites that we're going to assess.
So we will state how to fold the link pages and how to pass the DOD page content right here.
So this is what both of those functions are doing in our project.
So this files specifically defines what a scrap is going to do and the rest of the file simply defined
the scriber functionality.
So what we would do, our usual workflow for you is to create scrappier file like this and then add
different spiders so or different rules to assess this website.
But enough talking, let's run the quote spider and see what's going to happen.
So let's write ours and let's try to see the tutorial.
OK, let's right there with OK, let's assess spiders, OK?
Let's write their ways and you can see that our file was here, so let's try it.
They will write Python and then quote spiders.
OK, they'll save it.
So I save it and let's try it once again, ok.
I think it's another table somewhere.
Let's search for it.
So I will do ok.
So I imported Krupka wrong.
So I do scrapie.
That's it.
Let's save it and I will run the file again.
OK, so after you run the file in order to extract the links, we need to write scrapie crawl and then
quotes.
Just quotes.
OK, let's run this.
And as you can see now, we actually started scrapie and we started the old interlinks and getting responses.
So this is the output the that you can see in front of you.
So now if should get back to the directory, you can notice that two new files has been stored in the
directory.
And these are quotes, one in quotes, two, which are referring to each of the websites.
And how we know that is because of both of them are actually HTML files, which are specifically website
files.
And you can see them in actually two locations in front of you.
So select them and you can see that these are actually the HTML files of the websites that were assessed.
So this is how to actually extract information from the web with the scrapie.
And in the next video, we're going to talk a little bit more in depth how to use the information that
they just showed you and how to extract some additional information that you require.
That's it.
Thanks very much for watching and I'll see you in the next video.