33

IMDB provides plain text files user's can download and use which can be found here: IMDB Plain Text Files which is great but I don't see the ID used for each movie in any of the files.

Given IMDB specifically says not to use scrapers, data gatherers etc in their Conditions of Use how would one obtain the title ID http://www.imdb.com/title/tt1133985/ for each movie if they aren't included in any of the plain text files.

I've noticed there are some API's others have built that do include this ID so I'm wondering how did they manage to do that.

Gajus
  • 69,002
  • 70
  • 275
  • 438
PublicHandle
  • 512
  • 1
  • 5
  • 10

3 Answers3

32

You can use IMDB API located at

www.omdbapi.com

You can search for movie names like this -

http://www.omdbapi.com/?t=hangover%202

{
"Title":"The Hangover Part II",
"Year":"2011",
"Rated":"R",
"Released":"26 May 2011",
"Genre":"Comedy",
"Director":"Todd Phillips",
"Writer":"Craig Mazin, Scot Armstrong",
"Actors":"Bradley Cooper, Zach Galifianakis, Ed Helms, Justin Bartha",
"Plot":"Right after the bachelor party in Las Vegas, Phil, Stu, Alan, and Doug jet to Thailand for Stu's wedding. Stu's plan for a subdued pre-wedding brunch, however, goes seriously awry.",
"Poster":"http://ia.media-imdb.com/images/M/MV5BMTM2MTM4MzY2OV5BMl5BanBnXkFtZTcwNjQ3NzI4NA@@._V1_SX320.jpg","
Runtime":"1 hr 42 mins",
"Rating":"7.1",
"Votes":"13547",
"ID":"tt1411697",
"Response":"True"
} 

You can get the "ID" (tt1411697) from this JSON response.

Cat
  • 66,919
  • 24
  • 133
  • 141
Raj
  • 22,346
  • 14
  • 99
  • 142
  • I'm aware of already existing web services such as the one you linked but what would I have to do to obtain the ID myself. Would I have to hit the search page with a movie name and extract the ID from the number 1 match? What about if I want to do that for 1000 movies? Is that what imdbapi and other web services do? – PublicHandle Jun 24 '11 at 07:09
  • Yes, you have to do one by one for each movie using the IMDB API. No other go! – Raj Jun 24 '11 at 07:23
  • So imdbapi doesn't have all the title id's stored somewhere and they extract it dynamically given the name you search with? Doesn't that essentially mean imdbapi acts as a scraper for anyone searching for a large number of movies which is supposed to be against IMDB's condition of use? – PublicHandle Jun 24 '11 at 18:23
  • Yeah I suppose it is against IMDB's policy – Raj Jun 25 '11 at 05:10
  • That would be true if my API did actually get it's data from IMDb.com ;) – bfritz Aug 25 '13 at 03:27
  • @bfritz then where is it coming from? – Raj Aug 25 '13 at 10:05
  • @emaillenin lots of different sources, some of which are listed at the bottom of the API (Freebase/Wiki etc.) the IMDb ID has become the de facto choice among most API's and other sites. So once you have this ID (ttXXXXXXX) it's very easy to pull data from other resources than IMDb. – bfritz Aug 26 '13 at 22:24
18

As mentioned, IMDB does not have a web service. imdbapi works by screen scraping. The flat files available for download are a legacy from IMDB's pre-Amazon days, and the information there is incomplete. (You could not build your own IMDB with just the files that are available)

However, Rotten Tomatoes does have a nice web interface that returns, among other things, the imdb id of the films - in the alternate_ids section. So, you could use the Rotten Tomatoes API to obtain the imdb id without screen scraping imdb directly.

Rotten Tomatoes' database is less extensive than IMDB's, but it does a pretty good job with modern (1995+) US releases.

David Chappelle
  • 1,243
  • 5
  • 13
  • 29
5

You can try TMDb. You can check the documentation here - http://docs.themoviedb.apiary.io/. You can use append_to_response and can get the IMDB id along with other details. There is an alternate solution that I know of. The solution is in PHP. Here is the link - http://blogs.niteshapte.com/2013-07-01-how-to-fetch-movie-identifier-id-from-imdb-using-php.htm. You might need to tweak it as per your requirement.

Nitesh Apte
  • 45
  • 2
  • 6