1.1.0 • Published 8 years ago

the-rotten-api v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

The Rotten API

the-rotten-api is a Node.js wrapper for the Rotten Tomatoes API v1.0.

Installation

$ npm install --save the-rotten-api

Usage Examples

Movie search:

var rt = require('the-rotten-api');
rt.apiKey('your-api-key');

rt.movies('in_theaters', function(err, data) {
  if (err) { console.log(err); }
  
  console.log(data);
  
  /*
  { 
       id: '771321699',
       title: 'Star Wars: Episode VII - The Force Awakens',
       year: 2015,
       mpaa_rating: 'PG-13',
       runtime: 136,
       critics_consensus: '',
       release_dates: [Object],
       ratings: [Object],
       synopsis: 'The Star Wars saga continues with this seventh entry -- the first under the Walt Disney Co. umbrella. The film will act as the start of a new trilogy set after the events of Return of the Jedi. J.J. Abrams directs from a script by Michael Arndt. ~ Jeremy Wheeler, Rovi',
       posters: [Object],
       abridged_cast: [Object],
       alternate_ids: [Object],
       links: [Object] 
  },
  ...
  */
}

Movie info:

var rt = require('the-rotten-api');
rt.apiKey('your-api-key');

var movieId = 12897;

rt.info(movieId, function(err, data) {
  console.log('Title: ' + data.title);
  console.log('Year: ' + data.year);
}

/*
    Title: The Matrix
    Year: 1999
*/

Methods

Search

Search for movies.

.search(query | [options], callback)

Options:

NameDescriptionTypeRequired
queryThe plain text search query to search for a movie.StringYes
pageThe selected page of movie search resultsNumberNo
pageLimitThe amount of movie search results to show per pageNumberNo

Lists

Rotten Tomatoes available lists.

.lists(directory, callback)

NameDescriptionTypeRequired
moviesShows the movie lists we have availableStringNo
dvdsShows the DVD lists we have availableStringNo
empty stringDisplays the top level lists available in the API.StringYes

info

Detailed information on a specific movie specified by Id. You can also limit the results to cast and reviews.

.info(id | [options], callback)

NameDescriptionTypeRequired
idThe movie's idNumberYes
limitTocast or reviewsStringNo

movies

.movies(list | [options], callback)

Search for a specific list of movies.

NameDescriptionTypeRequired
listbox_office, in_theaters, opening, upcomingStringYes
limitLimits the number of box office movies returnedNumberNo
pageThe selected page of in theaters moviesNumberNo
countryProvides localized data for the selected country (ISO 3166-1 alpha-2) if available. Otherwise, returns US data.StringNo

Contribution

Contributions are welcome.

git clone the Github repository:

$ git clone https://github.com/gmontalvoriv/the-rotten-api.git

License

MIT