erunion / showtimes

[deprecated] a movie showtimes API
MIT License
52 stars 14 forks source link
movie showtimes theater

Showtimes · a movie showtimes API

NPM Travis CI js-standard-style

Installation

npm install showtimes --save

Usage

const Showtimes = require('showtimes');
const api = new Showtimes(10001, {});

api.getTheaters((error, theaters) => {
  if (error) {
    throw error
  }

  console.log(theaters);
});

Result

[ { id: '4c9f211a0800ff36',
    name: 'AMC Loews 34th Street 14',
    address: '312 W. 34th St., New York, NY',
    phoneNumber: '(888) 262-4386',
    movies:
     [ { id: 'cfbfd1f634e7638a',
         name: 'Star Wars: The Force Awakens 3D',
         runtime: '2hr 16min',
         rating: 'PG-13',
         genre: ['Scifi', 'Fantasy'],
         imdb: 'http://www.youtube.com/watch?v=tt08BH9COsI',
         trailer: 'http://www.imdb.com/title/tt2488496/',
         showtimes: [ '9:30am', '1:00pm', '4:30pm', '8:00pm' ] },
       { id: '89d9737d67580511',
         name: 'Star Wars: The Force Awakens',
         runtime: '2hr 16min',
         rating: 'PG-13',
         genre: ['Scifi', 'Fantasy'],
         imdb: 'http://www.youtube.com/watch?v=tt08BH9COsI',
         trailer: 'http://www.imdb.com/title/tt2488496/',
         showtimes: [ '10:00am', '1:30pm', '5:00pm', '8:30pm' ] } ] },
  { id: '7a9fd407207f4951',
    name: 'Bow Tie Chelsea Cinemas',
    address: '260 West 23rd Street, New York, NY',
    phoneNumber: '(212) 691-4744',
    movies:
     [ { id: 'cfbfd1f634e7638a',
         name: 'Star Wars: The Force Awakens 3D',
         runtime: '2hr 16min',
         rating: 'PG-13',
         genre: ['Scifi', 'Fantasy'],
         imdb: 'http://www.youtube.com/watch?v=tt08BH9COsI',
         trailer: 'http://www.imdb.com/title/tt2488496/',
         showtimes:
          [ '5:20am',
            '10:00am',
            '10:30am',
            '1:05pm',
            '1:35pm',
            '4:10pm',
            '4:40pm',
            '7:20pm',
            '7:50pm',
            '10:30pm',
            '11:00pm' ] }] }
  ...
]

Documentation

API

showtimes(location, options)

showtimes.getTheaters(callback)

showtimes.getTheater(theaterId, callback)

showtimes.getMovies(callback)

showtimes.getMovie(movieId, callback)

Standardized Responses

Theater

{
  id: '4c9f211a0800ff36',
  name: 'AMC Loews 34th Street 14',
  address: '312 W. 34th St., New York, NY',
  phoneNumber: '(888) 262-4386',
  movies: [<movies>],
  showtimes: ['9:30am', '1:00pm', '4:30pm', '8:00pm']
}

Movie

{
  id: 'cfbfd1f634e7638a',
  name: 'Star Wars: The Force Awakens 3D',
  runtime: '2hr 16min',
  rating: 'PG-13',
  genre: ['Scifi', 'Fantasy'],
  imdb: 'http://www.youtube.com/watch?v=tt08BH9COsI',
  trailer: 'http://www.imdb.com/title/tt2488496/',
  director: 'J.J. Abrams',
  cast: [<cast>]
  description: 'In this continuation of the "Star Wars" saga, ... the former Rebel Alliance.',
  theaters: [<theaters>],
  showtimes: ['12:20pm', '3:40pm', '6:30pm', '7:00pm', '9:50pm', '10:20pm']
}

Upgrading to v2

With v2, I've moved the entire library over to be written in ES6 so components can be easily reused with having the library internals be a proper class. Unfortunately, this has made v2 incompatibe with v1, but thankfully only a few minor things have changed with the API.

  1. Instead of calling the library as s = Showtimes(location), you must now instantiate the class with s = new Showtimes(location).
  2. The genre response that comes back from API calls is now represented as an array instead of a compounded string.