UNPKG

1.83 kBMarkdownView Raw
1# node-tvdb
2
3[![Build Status](https://travis-ci.org/edwellbrook/node-tvdb.svg?branch=master)](https://travis-ci.org/edwellbrook/node-tvdb)
4
5Node.js library for accessing [TheTVDB JSON API](https://api.thetvdb.com/swagger). Refactored from [joaocampinhos/thetvdb-api](https://github.com/joaocampinhos/thetvdb-api) to give nicer output and lots of additional features.
6
7Pull requests are always very welcome.
8
9## Features
10
11- Handle errors from API as JavaScript errors
12- Only returns relevant data (no need to call response.Data.Series etc.)
13- Set language at initialisation or on each function call
14- Return values through promises (dropped callback support)
15- Uses the new JSON API from TheTVDB
16- [Tests with Mocha and Travis CI](https://travis-ci.org/edwellbrook/node-tvdb)
17
18## Installation
19
20Install with [npm](https://npmjs.org/):
21
22``` shell
23npm install --save node-tvdb
24```
25
26And run tests with [Mocha](https://mochajs.org):
27
28``` shell
29TVDB_KEY=[YOUR API KEY HERE] npm test
30```
31
32> _Mocha is installed as a development dependency; you do not need to install it globally to run the tests._
33
34## Example Usage
35
36To start using this library you first need an API key. You can request one [here](http://thetvdb.com/?tab=apiregister). Then just follow this simple example that fetches all the shows containing "The Simpsons" in the name.
37
38``` javascript
39const TVDB = require('node-tvdb');
40const tvdb = new TVDB('ABC123');
41
42tvdb.getSeriesByName('The Simpsons')
43 .then(response => { /* process data */ })
44 .catch(error => { /* handle error */ });
45```
46
47## Full API Docs
48
49Generated API docs with code examples can be found at: [edwellbrook.github.io/node-tvdb](https://edwellbrook.github.io/node-tvdb/).
50
51For details on response data, please see [TheTVDB API docs](https://api.thetvdb.com/swagger).
52
53## License
54
55The MIT License (MIT)