Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 10: Movie Search App
Lecture: Movie HTTP service
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Let's begin this section, this app by talking about where we're going to get our movie data from.
0:07
We're going to use a movie service at movieservice.talkpython.fm. Now this is just a simple service with a subset of the movies,
0:16
there's only a couple of thousand movies here, but these are the movies that you can go and search,
0:21
and you'll see that there's a couple of things we can do with this basic api, we can search for movies by keywords,
0:28
so if I click on this, it will run a little example, in Firefox, it happens to parse and give this pretty view
0:35
but if we hit raw, you can see what comes back from the server is actually this json
0:39
we get a couple of things, we get the keyword sent back just to say what the server thought we searched for and the hits, the movies that matched.
0:48
So here we can see we've got Blade Runner when we searched for run, we've got Running With Scissors and a couple others,
0:56
we've got Kite Runner, things like that. So we can go and search for anything, put the keyword up here, we could search for particle,
1:04
it comes back with this movie called Particle Fever this is an absolutely awesome movie about Large Hadron Collider and search for the Higgs Boson,
1:13
one that I really like is one called Capital C, this is about crowd funding and kickstarters and stuff and this is really cool and interesting movie;
1:24
so let's see what we can find out about that, so if we come over here and we search for capital, you'll see that we get a couple of things,
1:32
we get Super Capitalists, we get Capital C, that's the one I was talking about, Capitalism a Love Story, okay, we have things like their IMDB code,
1:43
so we can pull them up on imdb.com and things like that if we wanted. We have keywords, genres, the year, rating and so on.
1:50
Okay, so we're going to use this movie service to go search for movies by keyword
1:57
we could also search by directory, or we could just pull them up by IMDB, so if I click here, you can see if this is searching by Cameron,
2:04
so James Cameron or Cameron Crowe, anyone who matches that, here's James Cameron, The Abyss, Terminator, Judgment Day, Titanic,
2:11
somewhere in there is Avatar, things like that. So we can search by director or just by IMDB number
2:16
so for example this one pulls up the Abyss by James Cameron where the IMDB code is right there.
2:23
Okay, so this works pretty well, I wouldn't use this for a real app and just because there's not that much data behind it,
2:31
it's just built for this course, for this specific purpose. But there's enough there that you can do some interesting queries;
2:39
if you are looking for a real API that's very similar to this it will work in a similar way to what we are doing,
2:45
is you can check out the OMDB API, the Open Movie Database. So, this actually used to be free, and you would be able to just go and use their API,
2:55
the API is very similar, you could come down and you could click on say Capital and it will do a request in a really similar way,
3:04
and it will give you things like if we put Capital C we could probably get that exact movie back from it, yeah, there you go.
3:12
So, we could do a similar search here but you have to pay for this, the minimum is like a dollar a month or something,
3:18
it's not crazy but it turned out that this free thing was kind of a victim of its own success, it did 44 terabytes of traffic in just one month
3:29
and that turns out to be super expensive. I ended up making this one just so you have a nice stable simple service to work with,
3:36
but if you want to build a real app, I'd recommend checking out OMDB API.