# subtitler

> Command line and library to search and download subtitles.

Latest version **2.7.0** (published 2019-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install subtitler
pnpm add subtitler
yarn add subtitler
bun add subtitler
```

Provides the command `subtitler`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.7.0 |
| Published | 2019-09-03 |
| First published | 2015-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.12 |
| Dependencies | 7 |
| Unpacked size | 33.9 KB |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 99 |
| Author | Oscar Brito |
| Maintainers | aetheon |
| Keywords | subtitle, subtitles, opensubtitles, movies, movie, client, search, find, download, command, library, rtorrent, torrent |

## Links

- npm: https://www.npmjs.com/package/subtitler
- Repository: https://github.com/divhide/node-subtitler
- Homepage: https://github.com/divhide/node-subtitler#readme
- Issues: https://github.com/divhide/node-subtitler/issues
- npm.io page: https://npm.io/package/subtitler

## Dependencies (7)

- [q](https://npm.io/package/q.md) 1.2.0
- [lodash](https://npm.io/package/lodash.md) 3.6.0
- [request](https://npm.io/package/request.md) ^2.88.0
- [mustache](https://npm.io/package/mustache.md) 2.2.1
- [argparser](https://npm.io/package/argparser.md) 0.2
- [xml-mapping](https://npm.io/package/xml-mapping.md) ^1.7.1
- [universal-analytics](https://npm.io/package/universal-analytics.md) ^0.4.20

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 2.7.0 (latest) — 2019-09-03
- 2.6.0 — 2016-07-02
- 2.5.0 — 2016-06-19
- 2.4.0 — 2015-07-25
- 2.3.0 — 2015-07-25
- 2.2.0 — 2015-07-25

## README

[![Divhide](http://blog.divhide.com/assets/images/divhide_192px.png)](http://divhide.com/)

# Subtitles library / command line

[![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CJCQT6QZCF8NA)
[![Build Status](https://travis-ci.org/divhide/node-subtitler.svg?branch=master)](https://travis-ci.org/divhide/node-subtitler/)
[![NPM version](https://badge.fury.io/js/subtitler.svg)](http://badge.fury.io/js/subtitler)

---

## Install

After have installed node.js, run the following:

```shell
npm install subtitler -g
```

## API

### Login - get the login token from the opensubtitle service

```js

var opensubtitles = require("subtitler");

opensubtitles.api.login()
.then(function(token){
	// got the auth token
});
```

### Search

```js

var opensubtitles = require("subtitler");

opensubtitles.api.searchForFile(login, lang, movieFilePath);
.then(functions(results){
	//got the search results
});

opensubtitles.api.searchForTitle(token, lang, text)
.then(functions(results){
	//got the search results
});

opensubtitles.api.searchForTag(token, lang, tag)
.then(functions(results){
	//got the search results
});

opensubtitles.api.search(token, lang, {
	query: "",
	tag: ""
})
.then(functions(results){
	//got the search results
});

```

### Logout - opensubtitles session logout ( please be nice! )

```js

var opensubtitles = require("subtitler");

opensubtitles.api.logout(login);

```

## Command line

```shell
subtitler <file|directory|seachText>
	--lang eng|pob|...
	-n <numberOfSubtitlesToDownload>
	--download
	--retries <numberOfRetries>
	--retryIn <secondsToRetry>
```
> if a file or directory is provided -- download is activated by default

> if free text  is provided -- performs a query into opensubtitles with it!

> --lang The language to search. Defaults to `LANG` environment variable.

> -n specifies the number of subtitles to list or download if (--download is specified)

> --download Flag to download the results. The downloaded result will have the same same as the file if it can, working well with TV players, etc...

> --retries The number of retries in API error

> --retryIn The seconds to wait before the next retry


### Languages

```js
//Portuguese
--lang por

//Brazilian
--lang pob

//English
--lang eng

 //French
--lang fre

//Spanish
--lang spa
```

Check the languages table on <a href="https://github.com/divhide/node-subtitler/blob/master/langs.dump.txt">here</a>.
Or the languages aliases on <a href="https://github.com/divhide/node-subtitler/blob/master/lib/LanguagesAliases.js">here</a>.

### Examples

Download subtitles for a file, automatically naming the subtitle file to be the
same as the movie.

```shell
subtitler Cars.avi --lang en_us
LANG=en_us subtitler Cars.avi
```

Search for subtitles (limit 5):

```shell
subtitler Cars --lang eng --n 5
```

Search and download to the current directory the first 5 subtitles:

```shell
subtitler Cars --lang eng -n 5 --download
```

## Contribute

Pull requests are welcome but please make sure the the linting and unit tests are working before you
do that. Also adding unit tests will increase the acceptance of the pull request by 10000%!

``` bash

grunt dev

```


## Authors

**Oscar Brito**

+ [github/aetheon](https://github.com/aetheon)
+ [twitter/aetheon](http://twitter.com/aetheon)

---
_Source: https://npm.io/package/subtitler · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
