Node.js library for accessing TheTVDB API. Refactored from joaocampinhos/thetvdb-api to give nicer output and lots of additional features.
Pull requests are always very welcome.
- Handle errors from API as JavaScript errors
- Only returns relevant data (no need to call response.Data.Series etc.)
- Set language at initialisation or afterwards when needed
- Normalised keys and values
- Empty values parsed as null
- Updates endpoint grouped by type
- Supports both node callback functions and promises
- Utility function to parse TheTVDB API's pipe list (e.g. "|Name|Name|Name|Name|")
- Use zip data instead of straight xml where possible
- Tests with Mocha and Wercker CI
Install with npm:
npm install --save node-tvdb
And run tests with Mocha:
TVDB_KEY=[YOUR API KEY HERE] npm test
Mocha is installed as a development dependency; you do not need to install it globally to run the tests.
To start using this library you first need an API key. You can request one here. Then just follow this simple example that fetches all the shows containing "The Simpsons" in the name.
var TVDB = require("node-tvdb");
var tvdb = new TVDB("ABC123");
tvdb.getSeriesByName("The Simpsons", function(err, response) {
// handle error and response
});
Set up tvdb client with API key and optional language (defaults to "en")
var Client = require("node-tvdb");
var tvdb = new Client("ABC123"); // lang defaults to "en"
var tvdbPortuguese = new Client("ABC123", "pt");
Get the current server time
tvdb.getTime(function(error, response) {
// handle error and response
});
OR
tvdb.getTime()
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get available languages useable by TheTVDB API
tvdb.getLanguages(function(error, response) {
// handle error and response
});
OR
tvdb.getLanguages()
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get basic series information by name
tvdb.getSeriesByName("Breaking Bad", function(error, response) {
// handle error and response
});
OR
tvdb.getSeriesByName("Breaking Bad")
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get basic series information by id
tvdb.getSeriesById(73255, function(error, response) {
// handle error and response
});
OR
tvdb.getSeriesById(73255)
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get basic series information by remote id (zap2it or imdb)
tvdb.getSeriesByRemoteId("tt0903747", function(error, response) {
// handle error and response
});
OR
tvdb.getSeriesByRemoteId("tt0903747")
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Note:
node-tvdb
automatically selects between remote providers (IMDb and zap2it)
Get full/all series information by id
tvdb.getSeriesAllById(73255, function(error, response) {
// handle error and response
});
OR
tvdb.getSeriesAllById(73255)
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get all episodes by series id
tvdb.getEpisodesById(153021, function(error, response) {
// handle error and response
});
OR
tvdb.getEpisodesById(153021)
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get episode by episode id
tvdb.getEpisodeById(4768125, function(error, response) {
// handle error and response
});
OR
tvdb.getEpisodeById(4768125)
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get series episode by air date
tvdb.getEpisodeByAirDate(153021, "2011-10-03", function(error, response) {
// handle error and response
});
OR
tvdb.getEpisodeByAirDate(153021, "2011-10-03")
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get series actors by series id
tvdb.getActors(73255, function(error, response) {
// handle error and response
});
OR
tvdb.getActors(73255)
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get series banners by series id
tvdb.getBanners(73255, function(error, response) {
// handle error and response
});
OR
tvdb.getBanners(73255)
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Get series and episode updates since a given unix timestamp
tvdb.getUpdates(1400611370, function(error, response) {
// handle error and response
});
OR
tvdb.getUpdates(1400611370)
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
All updates within the given interval
tvdb.getUpdateRecords("day", function(error, response) {
// handle error and response
});
OR
tvdb.getUpdateRecords("day")
.then(function(response) { /* handle response */ })
.catch(function(error) { /* handle error */ });
Parse pipe list string to javascript array
var list = "|Mos Def|Faune A. Chambers|"; // from a previous api call
var guestStars = Client.utils.parsePipeList(list);
The MIT License (MIT)