opensubtitles-universal-api
v1.2.0
Published
Universal API for opensubtitles.org, works both in node and browsers
Downloads
9
Readme
opensubtitles-universal-api
Universal API for opensubtitles.org, works both in Node.js and browsers.
Fork of https://github.com/SlashmanX/OpenSRTJS
Install
$ npm install --save opensubtitles-universal-api
Usage
import OpenSubtitles from 'opensubtitles-universal-api';
const api = new OpenSubtitles('OSTestUserAgent');
const episodeQuery = {
imdbid: 'tt0411008', // lost-2004 abc
season: 1,
episode: 1
};
api.search(episodeQuery)
.then(result => {
Object.keys(result) //=> ['en', 'ru', ...]
Object.keys(result.en[0]) //=> ['url', 'lang', 'downloads', 'score', 'subFilename', 'releaseFilename', 'date', 'encoding'];
});
const movieQuery = {
imdbid: 'tt0152930' // taxi 1998
};
api.search(movieQuery)
.then(result => {
Object.keys(result) //=> ['en', 'ru', ...]
Object.keys(result.en[0]) //=> ['url', 'lang', 'downloads', 'score', 'subFilename', 'releaseFilename', 'date', 'encoding'];
});
:warning: 'OSTestUserAgent' is intended only for the test usage. Use the instruction to get your own token.
Webpack example is available in /examples/browser-webpack
License
MIT © ewnd9