I have created a Ruby code that gathers information from IMDB and presents it in a nice class. The
code uses
why's hpricot v0.4.76.
Creating an object. The HTML is only loaded once as long as you have the object.
movie=IMDB.new("monty python holy grail")
or
menu=true
movie=IMDB.new("monty python holy grail",menu)
If using the IMDB class in a command line, the menu option will present you with the titles and years that are listed on the IMDB search site and you enter a number. If there is menu (default value is false) it will pick the first link found. If no links are found it raises an error
Now lets say you want to print the list of actors.
movie.actors.each{|name,role|
p name+" starred in "+ movie.title+" as "+role+"\n"
}
.actors is a hash where the key is he actor's name and the hash is the list of roles(CVS).
Although most movies do not have a plot IMDB still tries to list one.
p "This movies plot might be like: "+movie.plot
So far its not to hard. BUT BECKER!! I want the poster!
Have no FEAR (some what)!
movie.poster
This will return the a img html tag, I am working on making this better.
Some other things.
movie.director
movie.run_time
movie.year
movie.genres
movie.mpaa
movie.to_xml
IMDB has no published API. I have found no other sites providing a good API. So I made one.
http://stephenbeckeriv.com/movie/office_space
The title uses _ for spaces. You can also use %20 but I made it easy. You will have uri encode your titles.
Also if you are not getting the search result you want, try looking at the returning titles.
http://stephenbeckeriv.com/movie_titles/office_space
Please email me with comments and suggestions!