With the release of IMDB 0.3.0, a command-line utility is included!
Why is this awesome for you? Basically, because you can now query IMDB and process the results with any of the great GNU tools available to you like grep
.
Let me show you:
Search IMDB
$ imdb Star Trek
>> Searching for "Star Trek"
> 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)
> 0106145 | Star Trek: Deep Space Nine (1993) (TV series)
> 0117731 | Star Trek: First Contact (1996)
> 0084726 | Star Trek: The Wrath of Khan (1982)
> 0092007 | Star Trek IV: The Voyage Home (1986)
> 0079945 | Star Trek: The Motion Picture (1979)
> 0244365 | Enterprise (2001) (TV series)
For clarity, only the ten first search results are shown. I’m thinking of including an option to set the number of returned titles. Let me know what you think about that.
Getting movie details
So, let’s pick a movie we want to get details about.
$ imdb 0796366
>> Fetching movie 0796366
Star Trek (2009)
========================================================================
Rating: 8.4
Duration: 127 minutes
Directed by: J.J. Abrams
Cast: Chris Pine, Zachary Quinto, Leonard Nimoy, Eric Bana, Bruce Greenwood
Genre: Action, Adventure, Sci-Fi
A chronicle of the early days of James T. Kirk and his fellow USS Enterprise crew members. |
========================================================================
Combine with GNU commands
Or, as mentioned earlier, you can combine it with other console commands. So to get the rating of a movie, do this:
$ imdb 0796366 | grep "^Rating" | cut -d" " -f 2
8.4
Installation, source and issues
I’m still working on perfecting the console output, so if you have any tips, please report it in the form of an issue.
You can get this as a Ruby Gem with
sudo gem install imdb
The source is also available at http://github.com/ariejan/imdb.