Ruby Gem: IMDB

| Posted: - Last updated:
| Tagged general ruby imdb gem api
| ~200wrds (~1min)

I just released version 0.1.0 of my IMDB gem which allows your app to search IMDB for IMDB movie ID’s and access most data that’s publicly available.


sudo gem install imdb

This will also install the dependencies Hpricot and HTTParty.


In your project, include the gem (and possibly rubygems as well).

require 'rubygems'
require 'imdb'

search ='Star Trek')
=> #<Imdb::Search:0x18289e8 @query="Star Trek">

puts search.movies[0..3].collect{ |m| [, m.title].join(" - ") }.join("\n")
=> 0060028 - "Star Trek" (1966) (TV series)
        0796366 - Star Trek (2009)
        0092455 - "Star Trek: The Next Generation" (1987) (TV series)
        0112178 - "Star Trek: Voyager" (1995) (TV series)

st ="0796366")
=> #<Imdb::Movie:0x16ff904 @url="", @id="0796366", @title=nil>

=> "Star Trek"
=> 2009
=> 8.4
st.cast_members[0..2].join(", ")
=> "Chris Pine, Zachary Quinto, Leonard Nimoy"

As you can see, both Imdb::Search and Imdb::Movie are lazy loading, only doing a HTTP request when you actually request data. Also, the remote HTTP data is cached trhough-out the life span of your Imdb::Movie object.


Generated RDoc documentation can be found at

Issues, feature requests, patches, the works

Please use to supply patches (preferably through a pull-request) and to report issues.

My site is free of ads and trackers. I record privacy-respecting usage statistics with Fathom.

Was this post helpful to you? Why not ☕ Buy me a coffee or use Brave Browser to send a tip.