Ruby IMDB Library with Hpricot
Goal:
This project aims to provide a simple interface to the IMDB website. Orginaly designed to be the interface for a xml based web serice for IMDB.
The webservice needs to be updated.
This project is not to differnt from the few other ruby
projects.
We all scrap the website and parse the data. Since I use class names and relative node positions the class can break when IMDB changes the format of the website.
Download
Trunk:
Last commit
Tagged:
High Plains Drifter (2007-07-07)
Office Space (2007-02-18)(Broken)
Dependencies:
Hpricot 0.5 or greater
Gem:
I hope to have a gem soon.
Web Call
XML
Why would I make a to_xml method and not use it? You can get the xml for a movie by calling stephenbeckeriv.com/movie/title_name
For example
http://stephenbeckeriv.com/movie/office_space
If this is slow to return please forgive. There is no caching of data and the webserver is slow. I do not suggest using my site as the bases for your services. I will be glade to help configure, code, or answer questions if you want to set up your own service.
Tests
Run:
I have both functional and unit tests in the
svn.
Check out the code and run ruby test/unit/test_imdb.rb to see if Hpricot works correctly and ruby test/functional/test_office_space.rb to test the IMDB class.
Rcov:
I have checked in the rcov for the tests or you can view them here
Functional and
Unit.
Example:
require "imdb"
["scotland pa","MaLlRaTs","Doctor+Zhivago","blue_velvet","die hard"].each{|movie|
puts movie
movie=IMDB.new(movie)
pp movie.actors
pp movie.title
pp movie.poster_link
pp movie.rating
pp movie.aka
pp movie.also_known_as
pp movie.aspect
pp movie.aspect_ratio
pp movie.awards
pp movie.certification
pp movie.certifications
pp movie.certs
pp movie.color
pp movie.company
pp movie.country
pp movie.date
pp movie.director
pp movie.directors
pp movie.genre
pp movie.genres
pp movie.imdb_link
pp movie.keywords
pp movie.language
pp movie.mpaa
pp movie.page_html
pp movie.plot
pp movie.plot_keywords
pp movie.plot_outline
pp movie.poster_link
pp movie.rating
pp movie.ratings
pp movie.release_date
pp movie.runtime
pp movie.tagline
pp movie.user_comments
pp movie.writer
pp movie.writers
pp movie.title_search
pp movie.to_xml
sleep 30
}