https://github.com/ewnd9/opensubtitles-universal-api
Universal API for opensubtitles.org, works both in Node.js and browsers
https://github.com/ewnd9/opensubtitles-universal-api
opensubtitles
Last synced: 7 months ago
JSON representation
Universal API for opensubtitles.org, works both in Node.js and browsers
- Host: GitHub
- URL: https://github.com/ewnd9/opensubtitles-universal-api
- Owner: ewnd9
- Created: 2016-04-24T21:31:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-16T16:27:36.000Z (over 8 years ago)
- Last Synced: 2025-02-21T03:18:57.871Z (8 months ago)
- Topics: opensubtitles
- Language: JavaScript
- Homepage:
- Size: 53.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# opensubtitles-universal-api
[](https://travis-ci.org/ewnd9/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
```js
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](https://trac.opensubtitles.org/projects/opensubtitles/wiki/DevReadFirst) to get your own token.
Webpack example is available in [`/examples/browser-webpack`](./examples/browser-webpack)
## License
MIT © [ewnd9](http://ewnd9.com)