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.

21 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Abhinay you are a genius! I was thinking about asking you if there were any plans on covering Rotten Tomatoes as well, but I decided that it was asking for too much after the wonderful job you did on the IMDb Scraper. Will there be a compiled dll as well, for this release as well?

    Sincerely,

    Martien Oranje

    ReplyDelete
    Replies
    1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai

      Delete
  3. I think I found a way to scrape big posters as well (400x600), I don't know if you find that interesting. Anyway here's how:

    Go to the movies' picture page:
    http://www.rottentomatoes.com/m//pictures/

    Search for this line (only the number after context is variable). This should give you a the first poster shown when browsing RT for posters.
    <img src="http://content[0-9].flixster.com/rtmovie/

    It might seem like I'm spamming, but I'm actively developing my application right now,

    Cheers,

    Martien

    ReplyDelete
  4. Do you think you could add the short snippets from critics that shows on each rt page?

    ReplyDelete
  5. Update:
    Added short critic reviews scraping feature.

    ReplyDelete
  6. Hi, you might have corrupted your source code last time you saved it, it has html and web characters. Specifically, '>' and '>', and '<' for '<'.

    Unfortunately, even after I removed/replaced these, it still failed, silently this time (no error, though I do have them enabled on my server).

    ReplyDelete
  7. I have a RSS feed of movie titles and show times at my local cinema. I need help using this feed as an input to your PHP script then calling it as a shell command from Geektool. Can you help?

    ReplyDelete
  8. Thanks! This could be very handy.

    One addition I might make is to handle searches that might return multiple results. The first result would be used by default, but the user could choose from other results.

    I would combine this with a refined google query. For example:

    site:RottenTomatoes.com "movie info" search_terms

    By searching for movie info in quotes, Google will return only the movie pages. In your current version, a search for Kevin Bacon doesn't work. With the refined search terms, Google returns a list of Kevin Bacon movies. This could allow the user to search for an actor, or perhaps movies with the word love in the title, and then choose from the list returned by Google.

    ReplyDelete
  9. thanx abhinay, is it possible to create asp.net c# version of this?

    ReplyDelete
  10. can u provide Movie image not url

    ReplyDelete
  11. Great library, thanks for this source, it helps learn how to write scrapers for any other website. Is it possible to do search and scrap all the results, or just one movie only?

    ReplyDelete
  12. Hi Abhinay,
    Ive seen lots of implementation rotten tomatoes api with wordpress. is it possible for blogspot?

    ReplyDelete
  13. Hi Great stuff Abhinay, but how can i scrape the poster and photos?

    ReplyDelete
  14. Is there a way to get full reviews instead of the default quotes ?
    Would love to know if there is.

    ReplyDelete
  15. Bummer, they changed the formatting so that the image url is no longer provided. Awesome work though!

    ReplyDelete
  16. how to get POSTER image and video

    ReplyDelete
  17. mytectra placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance.

    ReplyDelete
  18. Guaranteed #1 Search Engine Ranking Supreme Free Viral Traffic Join Now Get Millions Of Hits Free To Your Site/Blog!

    PornKings Adult Shopping Backlinks-Shopping Mega Store Legendary Stars As Stormy Daniels,Shawna Edwards,Jenna Jamison-New Adult Stars Movies,Adult Toys,Enhancers,Merchandise-More !

    Hits Express Rotator System Do You Need Visitors to Your Website or Affiliate Program? If your looking to gain more visitors to your website Hits Express is your answer. With our program your site is being shown to people all over the world 24/7 365 days a year!

    PAYDIR Free For All Forum Portal Search Engine Crawled Network PR10 Ranking Information Forum XXX!

    FreeLinkExchanges Be Seen In 12 Nations 312 Sites Over 30 Millions Viewers Monthly Buy Featured Link Now With 150 Search Engines Crawling The Network!

    How do I get guaranteed traffic? When someone signs up from your site, they must first click on your classified ad which will open a new window leading to your main website. They will have to wait a few seconds for the code to appear on a separate frame at the top of the screen reach millions free now!

    Blast Your Ad to Over 23,000 Opt-in Prospects at ShowMyLinks Submit Your Solo Email Ad to All Showmylinks Members GET YOUR TEXT LINK ADs LISTED 100% FREE FOR LIFE PLUS EARN MONEY TO YOUR PAYPAL!!

    Adult Store Empires Backlinks Resources Search Engine XXX!

    GET YOUR OWN MONEY-MAKING AD BOARD -- Integrating Text ad, Banner Ad and Email Ad into one Portal Make Money Fast With Your Paypal Reach Million Dollars In A Year Fast !

    Full Length Homemade Videos Watch real people's private home sex videos. Forget about those shitty 1-2 minute clips, these are all high quality full length videos! 40+ Bonus Sites You will also get full access to the entire reelpass network of sites which features over 40+ awesome movie sites, 1000's of movies and pictures to download! Download, Burn & Share Not only do you get to watch all our movies, you can also download every single one and save it forever, burn them to dvd or share with friends!!

    ReplyDelete

Thanks a lot for your valuable comments :)