Sunday, October 30, 2011

IMDb Search Suggestions with jQuery Autocomplete

In conjunction of my previous posts on IMDb Scraper API and jQuery Autocomplete with multiple search suggestions, on popular demand, I’ve created yet another search suggestion tool to fetch suggestions from IMDb.com. I’ve implemented a simple PHP Proxy script to get search suggestions from IMDb and format it according to jQuery Autocomplete Widget’s JSON data format.

For downloading and a guide to setup the suggestions tool on your website please visit the demo page on my labs section. You will need the suggest.php and imdbImage.php Proxy files for pulling content from IMDb.

Demo: http://lab.abhinayrathore.com/imdb_suggest/

IMDb’s suggestion API provides Title Name, Title Id, Cast, Type and Poster URL to display in the dropdown. You can customize the JavaScript code for your needs. IMDb has a leechers policy in place for media images so I’ve also included a PHP Proxy script to show IMDb Posters on search dropdown.

Saturday, October 1, 2011

jQuery Autocomplete with Multiple Search Engines

Search suggestions are one of the most important features people like to include on their sites as it minimizes the chances of typo errors and facilitate easy search my providing relevant suggestions in real time. I use a similar search suggestion tool on my personal dashboard page which works exactly like the Google suggest page. I thought of expanding it to include suggestions from multiple search engines so if I want to search some product on Amazon or some knowledge article on Wikipedia, it would get suggestions from all the engines at once. Here you can find an easy way to incorporate multiple search suggestions on your pages using jQuery and a small PHP script which combines the search suggestions.

Demo and Download: http://lab.abhinayrathore.com/autocomplete/

Search suggestion engines it can support out of the box are: Google, Bing, Yahoo, Wikipedia, Amazon and Ebay.

For adding more suggestion engines, you can read the Configuration Options section on the page above. You can download the PHP script to combine multiple search suggestions from the link above.

Tuesday, June 14, 2011

IP Address Geocoding API for Google Maps

IP Address Geocoding is getting more and more popular with people who are building their own analytics tools or want to track their users. There are a lot of free geocoding web services available which can return the geocoded data in text, XML or JSON format, the most popular ones being http://freegeoip.net, http://ipinfodb.com, http://www.hostip.info, http://www.maxmind.com and many others. Geocoded data from these website can be easily accesses by using any server side scripts, but I wanted to build a JavaScript based solution which only works using asynchronous AJAX calls. For this API I used a free web service provided by http://freegeoip.net/ which returns data in XML(http://freegeoip.net/xml/) or JSON(http://freegeoip.net/json/) format and recently added JSONP callbacks so we can implement a pure JavaScript based API.

This API uses Google Map Api to display map and geotag the IP Address. You will have to sign up for Google Map API if you haven't already done for your domain.

For demo and more information on how to use this API, please visit my lab page at:
http://lab.abhinayrathore.com/ipmapper/

Please drop a comment below if you like this API or have any modifications or improvements.

Saturday, May 7, 2011

jQuery YouTube Popup Player Plugin

As an enhancement to the YouTube Popup player tool I built almost 2 years back, I have created a jQuery plugin to display YouTube videos in a popup dialog box. This plugin embeds YouTube video using the latest iFrame code which features both Flash and HTML5 players. To display the popup dialog box I have used the jQuery UI Dialog Widget which provides a robust cross-browser dialog box with title bar and supports a movable box with modal behavior. You can even customize the jQuery UI Dialog Widget theme to suit the color and style of you website.

This is a very easy to use plugin and is flexible enough to be used on any DOM element which supports the JavaScript onclick event. You will just need to include the YouTube Video Id in any of the DOM element attributes (default: rel) and initialize it in the plugin options (if other than rel). You can even provide a Title to the popup dialog box by defining it in the element’s title attribute or plugin options.

This plugin offers many configuration options for the dialog box and YouTube video player. You can find more detailed information for configuration and setup on the demo/documentation page.

For complete demo, documentation and download visit my lab page
http://lab.abhinayrathore.com/jquery_youtube/

jQuery_YouTube_Popup_Player_Plugin_700

Please drop me a word in the comments below if you have any modification/enhancements/bug fixes or any new feature to be added to this plugin.

Changelog

UPDATE v2.3, Date: Feb 26, 2013: The biggest change in this version is that now you don't need to have the YouTube Id to embed the video links. You can now have regular YouTube URLs in the href attribute and don't need to assign the id in a separate attribute for links. If you want to use other DOM elements like images or buttons, you will still need the Id. This version is backward compatible with the old versions.
Also added a new configuration option:

  1. cssClass: (default: empty string) Attribute containing the CSS class to be assigned to the popup div.

UPDATE v2.2, Date: Aug 30, 2012: Removed some deprecated parameters from the options list

UPDATE v2.1, Date: May 23, 2012: Added 1 new configuration option:

  1. useYouTubeTitle: (default: true) Gets the video title from YouTube automatically. This option will not work if the title is overridden using the title option. If set to false, the title will fallback to the title attribute of the element.

UPDATE v2.0, Date: Oct 20, 2011: Added 3 new configuration options:

  1. hideTitleBar: (default: false) Hide the Title Bar of the Dialog Widget. (Only works with Modal option enabled.)
  2. clickOutsideClose: (default: false) Closes the Popup Dialog when clicked outside on the Modal overlay. (Only works with Modal option enabled.)
  3. overlayOpacity: (default: 0.5) Sets the opacity value (from 0 to 1) for the Dialog Widget overlay.

Saturday, February 26, 2011

jQuery Nivo Slider with CSS3 Round Corners

First things first, kudos to John O'Nolan for jQuery Nivo Slider. Great stuff! I was trying to use this slider on my website and wanted to use CSS3 round corners. Unfortunately I was not able to use round corners on the outer div because of the multiple slides overlapping over it. I tried many ways of achieving this using CSS but couldn’t find an optimal way to do it. Finally I modified the Nivo Sliders JavaScript library to include round corners without modifying the CSS file. I added a new option (borderRadius) which can be defined when the slider is initialized.

Demo on my Labs page

How to download and use this modified library:

  1. Download and configure the library as described by the original developer: http://nivo.dev7studios.com/#usage
  2. Get the new JavaScript file and use it instead of the original library file:
  3. NO changes required in the CSS file.
  4. Add new “borderRadius” option while initialization to define the border radius (default value is 10px).

Example usage:
$(window).load(function() {
    $('#slider').nivoSlider({ borderRadius: 20 });
});

Thanks once again to John for this awesome script. Keep up the good work.
Let me know if you find any bugs in the script and I’ll try to address them asap.

del.icio.us Tags:

Saturday, January 29, 2011

Free PHP Rotten Tomatoes Scraping API

In continuation to my previous posts on PHP and ASP.NET IMDb Scraping API’s, I have designed one more movie information scraping API for RottenTomatoes.com. Rotten Tomatoes is one of the most popular movie review website which provides a comprehensive movie rating system involving critics from all the popular news networks.

This API includes scraping of lot of attributes from Rotten Tomatoes along with the functionality of scraping newly released DVD list. You can extend the PHP code on your own to include more functionality or drop a comment here and I’ll try to help you as much as I can.

Here is a list of all the attributes it scraps from Rotten Tomatoes page:

  1. TITLE
  2. YEAR
  3. POSTER
  4. ALL_CRITICS_PERCENTAGE
  5. ALL_CRITICS_AVERAGE_RATING
  6. ALL_CRITICS_COUNT
  7. USER_PERCENTAGE
  8. USER_AVERAGE_RATING
  9. USER_COUNT
  10. GENRES
  11. SYNOPSIS
  12. MPAA_RATING
  13. RUNTIME
  14. RELEASE_DATE
  15. BOX_OFFICE
  16. DIRECTORS
  17. WRITERS
  18. CAST
  19. REVIEWS

How to use this API:
Include the class file on your php page
include("rottentomatoes.php");
Instantiate the class and get the results in an array:
$rottentomatoes = new RottenTomatoes();
$movieArray = $rottentomatoes->getMovieInfo("Inception");

How to get the New DVD Release list:
$rottentomatoes = new RottenTomatoes();
$dvdArray = $rottentomatoes->getNewDvdReleases();

You can try this scraper on my lab page: http://lab.abhinayrathore.com/rottentomatoes/

Download PHP Source Code: http://lab.abhinayrathore.com/rottentomatoes/rottentomatoes2.htm

Example usage: http://lab.abhinayrathore.com/rottentomatoes/usage.txt

If you need some more additions or corrections to this API, please drop a comment here and I’ll try to include it asap.