You are hereBlogs / alif's blog / jImdb: jQuery Imdb Grabber Plugin

jImdb: jQuery Imdb Grabber Plugin


By alif - Posted on 31 August 2009

This jQuery Plugin (jimdb) allows you to Grab Movie Details from an IMDB Webpage very easily. It grabs the basic details (Title, Director, Writers, Release Date, Tag line, Plot, Runtime, MPAA, Language, Aspect Ratio, Country) from the IMDB Page and Returns the data in JSON Format.

To overcome Javascript Cross-domain restriction, a server-side proxy file has been provided in PHP with the plugin.

This Plugin no longer works since IMDB Changed their layout on Oct 2010. Please check out my other IMDB PHP Grabber

The Plugin has the following Method:


jQuery.imdb.grab( full-url-of-imdb-page, [options], [callback]); 

Basic Usage:

At first include the jquery.js file and the plugin file:


Now call the method $.jimdb.grab, with the IMDB URL to get its contents:

// call the method below with no options, for basic usage

$.imdb.grab('http://www.imdb.com/title/tt0167260/', function(data) {
  // check status, if its OK, then data contains the grabbed info, so, append it to some div
   if( data.status == "OK" ) {
    $('#someDiv').append("Director: "+ data.director+"
" + "Release: " + data.releaseDate + "Tag Line: "+ data.tagline + "Plot: "+ data.plot + "MPAA:"+data.mpaa + "Country:" + data.country ); } else { alert( data.message ); } });

Below is a full details of all the JSON properties of the returned result (i.e. data). The names are self-explanatory and is in camelCase.

Returned result's (JSON) Properties: Explanation/Details of the Property
status The Status of the process. Returns "OK" or "Error". If status = "error", then an error occured while grabbing. If its "OK", then grabbed successfully.
message The Status Message. If Error occurs, this message will explain the error, If there was no error, the message will be "Success".
director The Director(s) of the Movie
releaseDate The Release Date of Movie
tagline The Tag Line of the Movie
plot The Plot of the Movie
mpaa The MPAA Rating of the Movie
runtime The Running time of the Movie
country The Country of the Movie
language The Language(s) of the Movie
color Color of the Movie
aspectRatio The Aspect Ratio of the Movie
key Only used if keyValue is set to true on option. This contains a Javascript Array containing all the keys
val Only used if keyValue is set to true on option. This contains a Javascript Array containing all the corresponding values of keys

Customizing

The Options (2nd parameter) allows you to grab the returned result in key/value pair and also let you specify your own server-side proxy file.

Option Properties: Explanation/Details of the Property
keyValue Possible Values: true or false. When keyvalue is set to true. The JSON data is returned in key/value pair
proxyFile The Path to the Server-side Proxy File. If you decide to choose a different Proxy File, then set proxyFile = path-of-proxy File. If this is not set, then it picks the default proxy file in php, (proxy.php)

Set the keyValue to true, to return the result in a key/value* pair. Here's an example:

$.jimdb.grab('http://www.imdb.com/title/tt0167260/', { keyValue: true }, function(data) {
        // check status 
        if( data.status == 'OK') {
           // now data has the values in 2 separate arrays as key/values, so you can run a loop
           for(var i=0;i < data.key.length;i++) { $('#someDiv').append('

'+data.key[i]+'

'+data.val[i]); } } else { alert(data.message); } });

To set your own server-side proxy File, do the following:
$.jimdb.grab('http://www.imdb.com/title/tt0167260/', {proxyFile: 'my-proxy-file.php'} , function(data) {

});
Tip: Sometimes, grabbing a file via Javascript may take more than a few secs, so to show a progress bar, ajaxStart and ajaxStop Method of jQuery can be used.

Download the Plugin: http://plugins.jquery.com/project/jimdb

Great post! Thanks for sharing!

machine a sous

Wow, very cool plugin. I've been looking for this a long time!

Great Plugin. Its simple and neat.

plugin work perfectly :)

thanks a lot

I am preparing site for one insurance company. I wanted to show comparison of the auto insurance rates. Can you please tell me which plugin to be used to show the comparison.

I tryed this plugin but it works only in IE7, it's slow in IE6 and doesn't work at all in IE8.
Silus
-----------------
Top 5 destinations in France

really neat plugin, would it be possible to show actors like top 5-10 or something?

Yes, It would require some code modifications.

I tried this plugin. It works great, but its very slow on IE-6. I noticed you mentioned it as well on the plugin page, any chance of improving its performance on ie-6?.

Does anyone have problem with IE8?

Thank you - email extractor

Hi,

Thanks for trying out this plugin. As of now, I have no plans for improving performance on IE-6. IE-6 is slowly phasing out from the market, so I don't intend to spend time on it, just to improve the performance :).

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.