Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alxhotel/opensubtitles-js

:book: An Opensubtitles API wrapper for Node.js (unmantained)
https://github.com/alxhotel/opensubtitles-js

api-wrapper opensubtitles opensubtitles-api opensubtitles-js

Last synced: about 1 month ago
JSON representation

:book: An Opensubtitles API wrapper for Node.js (unmantained)

Awesome Lists containing this project

README

        

# opensubtitles-js

[![NPM Version](https://img.shields.io/npm/v/opensubtitles-js.svg)](https://npmjs.com/package/opensubtitles-js)
[![Build Status](https://img.shields.io/github/workflow/status/alxhotel/opensubtitles-js/ci/master)](https://github.com/alxhotel/opensubtitles-js/actions)
[![Dependency Status](https://img.shields.io/librariesio/release/npm/opensubtitles-js)](https://libraries.io/npm/opensubtitles-js)

**[Opensubtitles.org](http://opensubtitles.org) API wrapper for Node.js**

## Example usage

#### Setup
npm install opensubtitles-js

#### Login
```js
var Opensubtitles = require('opensubtitles-js');

var subs = new Opensubtitles({
user: 'username',
password: 'password',
language: 'en',
userAgent: 'OSTestUserAgent'
})

subs.login()
.then(function(token) {
console.log(token)
}).fail(function(error) {
console.log(error)
})
```

Example output:
```js
tokenid1234567890
```

#### Search Episodes
```js
var Opensubtitles = require('opensubtitles-js');

var subs = new Opensubtitles()

var query = {
imdbid: "tt1844624",
season: "2",
episode: "3",
filename: "American.Horror.Story.S02E03.720p.HDTV.X264-DIMENSION"
}

subs.searchEpisode(query)
.then(function(result) {
console.log(result)
}).fail(function(error) {
console.log(error)
})
```

Example output:
```js
Object {
pt: {
url: 'http://dl.opensubtitles.org/en/download/filead/src-api/subs_name.srt',
lang: 'pt',
downloads: '56',
score: 0
},
nl: {
url: 'http://dl.opensubtitles.org/en/download/filead/src-api/subs_name.srt',
lang: 'nl',
downloads: '1598',
score: 100
},
es: {
url: 'http://dl.opensubtitles.org/en/download/filead/src-api/subs_name.srt',
lang: 'es',
downloads: '1576',
score: 100
}
}
```

#### All Methods

*NOTE: Example outputs for these methods can be found at [Opensubtitles' documentation](http://trac.opensubtitles.org/projects/opensubtitles/wiki/XMLRPC)*

- LogIn(username, password, language, useragent)
- LogOut(token)
- SearchSubtitles(token, queries)
- SearchToMail(token, langs, movies)
- CheckSubHash(token, subsHash)
- CheckMovieHash(token, moviesHash)
- CheckMovieHash2(token, moviesHash)
- InsertMovieHash(token, moviesInfo)
- TryUploadSubtitles(token, sub)
- UploadSubtitles(token, sub)
- DetectLanguage(token, texts)
- DownloadSubtitles(token, subid)
- ReportWrongMovieHash(token, IDSubMovieFile)
- ReportWrongImdbMovie(token, movie)
- GetSubLanguages(language)
- GetAvailableTranslations(token, program)
- GetTranslation(token, iso639, format, program)
- SearchMovieOnIMDB(token, query)
- GetIMDBMovieDetails(token, imdbid)
- InsertMovie(token, movie)
- SubtitlesVote(token, vote)
- GetComments(token, subids)
- AddComment(token, comments)
- AddRequest(token, request)
- AutoUpdate(programName)
- NoOperation(token)

## License

This code is based on [opensubtitles-api](https://github.com/vankasteelj/opensubtitles-api) done by [@vankasteelj](https://github.com/vankasteelj)

So, this code is registered under GPLv3

Author of this fork is [@alxhotel](http://github.com/alxhotel).