opensubtitles-js

1.0.2 • Public • Published

opensubtitles-js

Opensubtitles.org API wrapper for Node.js

Example usage

Setup

npm install opensubtitles-js

Login

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:

tokenid1234567890

Search Episodes

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:

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

  • 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 a fork from here done by vankasteelj

So, this code is registered under GPLv3

Author of this fork is alxhotel.

Package Sidebar

Install

npm i opensubtitles-js

Weekly Downloads

0

Version

1.0.2

License

GPL-3.0

Last publish

Collaborators

  • alxhotel