jImdb: jQuery Imdb Grabber Plugin
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.
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
View Demo
I tryed this plugin but it
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
really neat plugin, would it be possible to show actors like top 5-10 or something?
Yes, with some code modification
Yes, It would require some code modifications.
Works fine, but slow on IE 6
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
Does anyone have problem with IE8?
Thank you - email extractor
No plans as of now
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