Skip to content
forked from maxkueng/eztvapi

A client for the Popcorn TV shows API, eztvapi.re

License

Notifications You must be signed in to change notification settings

olafurr/eztvapi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eztvapi

A client for the Popcorn TV Shows API (eztvapi.re).

Installation

npm install eztvapi --save

API

To see what the result of each function looks like check out the Popcorn API docs.

eztvapi([options])

Create an API client object.

The client has built-in rate limiting functionality. By default it limits API calls to one request per second. You can change it by passing the right options.

var eztvapi = require('eztvapi');

var eztv = eztvapi({
  apiLimitRequests: 10,    // 10 requests
  apiLimitInterval: 60000  // per minute
});

options

  • apiUrl (optional; default: http://eztvapi.re): The base URL of the API. Note that there is no slash at the end.
  • apiLimitRequests (optional; default: 1): The maximum number of requests per a given interval.
  • apiLimitInterval (optional; default: 1000): The duration in milliseconds

eztv.getShows(page, callback)

Get a list of TV shows (paginated, 50 per page).

var eztv = require('eztvapi')();
var page = 1;

eztv.getShows(page, function (err, shows) {
  if (err) { return console.log('No such page or something went wrong'); }

  console.log(shows);
});

stream = eztv.createShowsStream()

Create a stream that emits every show.

var eztv = require('eztvapi')();

var stream = eztv.createShowsStream();

stream.on('data', function (show) {
  console.log(show);
});

stream.on('end', function () {
  console.log('All done');
});
var through = require('through2').obj;
var eztv = require('eztvapi')();

var shows = eztv.createShowsStream();

var log = through(function (show, encoding, callback) {
  console.log(show.title);
  callback();
});

shows
  .pipe(log);

eztv.getShow(imdbId, callback)

Get information about a show including episodes and seasons by its IMDB ID (imdb_id).

var eztv = require('eztvapi')();
var imdbId = 'tt0944947';

eztv.getShow(imdbId, function (err, show) {
  if (err) { return console.log('No such show or something'); }

  console.log(show.title);
  // Game of Thrones
});

License

MIT

About

A client for the Popcorn TV shows API, eztvapi.re

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%