GithubHelp home page GithubHelp logo

yifysubtitles's Introduction

XO code style Build Status

yifysubtitles

Download and convert subtitles in VTT format for YTS movies

Install

$ npm i yifysubtitles --save

Or using yarn

$ yarn add yifysubtitles

Usage

const yifysubtitles = require('yifysubtitles');

const results = await yifysubtitles('tt1156398', {
  path: '/tmp',
  langs: ['en', 'fr', 'zh']
});
console.log(results)
/*
[
  {
    lang: 'english',
    langShort: 'en',
    path: '/tmp/Zombieland.2009.720p.BrRip.x264-YIFY.vtt',
    fileName: 'Zombieland.2009.720p.BrRip.x264-YIFY.vtt'
  },
  ...
]
*/

API

yifysubtitles(imdbId, [options])

Returns an Array of the downloaded subtitles.

imdbId

Type: String

options

Type: Object

langs

Type: Array
Default: ['en']
Array of the langs wanted.

path

Type: String
Default: __dirname
The path where the subtitles are going to be stored.

format

Type: String
Default: vtt
The format of subtitles. ['srt', 'vtt']

concurrency

Type: number
Default: Infinity
Minimum: 1 Download multiples subtitles concurency.

License

MIT © Mrdotb

yifysubtitles's People

Contributors

amilajack avatar fdrissi avatar mrdotb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yifysubtitles's Issues

TypeError: Cannot read property 'tt1156398' of undefined

I am on Ubuntu 16.04 LTS, I've successfully installed your package with npm i yifysubtitles --save although I got some warnings:

npm WARN enoent ENOENT: no such file or directory, open '/root/package.json'
npm WARN root No description
npm WARN root No repository field.
npm WARN root No README data
npm WARN root No license field.

But every time I try to run your example on the front page with node I am getting the following error:

TypeError: Cannot read property 'tt1156398' of undefined
    at runConditional (/root/node_modules/yifysubtitles/index.js:64:37)
    at apiCall.then.res (/root/node_modules/yifysubtitles/index.js:82:42)
    at process._tickCallback (internal/process/next_tick.js:109:7)

Any ideas on how to fix this?

Response code 403 (Forbidden)

I got this error while testing this code:
`const yifysubtitles = require('yifysubtitles')

const getSubs = async () => {
try{
const results = await yifysubtitles('tt1375666', {
path: '/subs',
langs: ['ar']
})
}catch(err){
console.error('error: ', err)
}
}
getSubs()`

full error body:

GotError [HTTPError]: Response code 403 (Forbidden)
at EventEmitter. (E:\WebDev\Node\subs\node_modules\got\source\as-promise.js:74:19)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
host: 'www.yifysubtitles.com',
hostname: 'www.yifysubtitles.com',
method: 'GET',
path: '/movie-imdb/tt1375666',
socketPath: undefined,
protocol: 'https:',
url: 'https://www.yifysubtitles.com/movie-imdb/tt1375666',
gotOptions: {
path: '/movie-imdb/tt1375666',
protocol: 'https:',
slashes: true,
auth: null,
host: 'www.yifysubtitles.com',
port: null,
hostname: 'www.yifysubtitles.com',
hash: null,
search: null,
query: null,
pathname: '/movie-imdb/tt1375666',
href: 'https://www.yifysubtitles.com/movie-imdb/tt1375666',
retry: {
retries: [Function (anonymous)],
methods: [Set],
statusCodes: [Set],
errorCodes: [Set]
},
headers: {
'user-agent': 'got/9.6.0 (https://github.com/sindresorhus/got)',
'accept-encoding': 'gzip, deflate'
},
hooks: {
beforeRequest: [],
beforeRedirect: [],
beforeRetry: [],
afterResponse: [],
beforeError: [],
init: []
},
decompress: true,
throwHttpErrors: true,
followRedirect: true,
stream: false,
form: false,
json: false,
cache: false,
useElectronNet: false,
method: 'GET'
},
statusCode: 403,
statusMessage: 'Forbidden',
headers: {
date: 'Sun, 25 Jul 2021 10:53:59 GMT',
'content-type': 'text/html',
'transfer-encoding': 'chunked',
connection: 'close',
vary: 'Accept-Encoding',
'cf-cache-status': 'DYNAMIC',
'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
'report-to': '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=LU8kcWWCvUqWVcVzvj0TgXa0Q77menyXpA40hAJFrPvGXwUXUT4tD6qq%2BtWIup1wHiVXuWGYy6A7kkXFCguPhkZ9%2FVEQrbVKfF6cIJmiBEtvu4tiQFr3DKDdKJgizUkOe5BD%2F4a3cj0%3D"}],"group":"cf-nel","max_age":604800}',
nel: '{"report_to":"cf-nel","max_age":604800}',
server: 'cloudflare',
'cf-ray': '6744d8fe8fb91141-MAD',
'content-encoding': 'gzip',
'alt-svc': 'h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443"; ma=86400'
},
body: '\r\n' +
'<title>403 Forbidden</title>\r\n' +
'\r\n' +
'

403 Forbidden

\r\n' +
'
openresty\r\n' +
'\r\n' +
'\r\n'
}

srt format

Hi,
is it possibile to add an option on yifysubtitles call (like paths, langs...) to download the subtitles in srt format instead vvt?
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.