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