WEBVTT

00:00.800 --> 00:01.700
Hello, everyone.

00:01.700 --> 00:10.220
So someone asked me, how can you build a API that is basically connected with our scraper?

00:10.700 --> 00:16.190
And basically there's two ways that you can.

00:17.210 --> 00:18.290
Approach this.

00:18.290 --> 00:23.630
You can either have a scraper that is run at a timed interval.

00:23.810 --> 00:29.830
So, for example, a scraper that is running every hour saves the data to a database.

00:29.840 --> 00:37.670
And then you have a separate application, a API, which is serving the data from the database basically.

00:37.970 --> 00:46.190
And then you can have a front end application or just a basic website which is displaying the APIs data.

00:47.690 --> 00:49.040
The other way.

00:49.040 --> 00:53.180
You can have, uh, you can do this approach.

00:53.180 --> 00:59.810
Having a API to a scraper is to do a sort of in demand scraping.

00:59.810 --> 01:08.060
So if the scraper is fast enough, maybe you could even just have a get request, just a get request

01:08.060 --> 01:14.630
for the, the scraper and the scraper returns the result from the website.

01:14.690 --> 01:22.130
If the scraper is a little slower, maybe you would do sort of a create or post request and you would

01:22.130 --> 01:25.970
maybe get an ID back of the scraping request.

01:25.970 --> 01:32.420
And then once the scraping has finished, you could use this ID to get the data once the scraping has

01:32.420 --> 01:33.170
finished.

01:33.410 --> 01:37.890
In both cases you could save the scraping result to a database.

01:37.910 --> 01:48.600
You could either be a document driven, driven database such as MongoDB or it could be a SQL database.

01:49.750 --> 01:54.040
So that's what we're going to look at in this section in particular.

01:54.040 --> 02:02.200
It's going to be GraphQL for now and then it's going to be MongoDB or Mlab, which we're going to be

02:02.200 --> 02:02.980
using.

02:03.190 --> 02:10.090
So hang in there and we'll look at how you can save your scraping results to a mlab.

02:10.940 --> 02:15.290
Database and how you can expose the data on GraphQL.
