yify-subs
v1.0.0
Published
YifySubtitles Api For nodejs
Downloads
81
Maintainers
Readme
yify-subs
Yify Api For nodejs
Quick start
npm install yify-subs
Then:
var YFsubs = require("yify-subs");
YFsubs.getSubs(imdbId).then(function(data){
console.log(data);
});
imdbID: movie id from imdb ex: 0478970 or tt0478970
Examples:
exemple of data result for (tt0478970):
YFsubs.getSubs("0478970").then(function(data){
console.log(data);
});
If successful, will return:
Object { languages: [ 'fr', 'ja', 'es', 'ar', 'el' ],
subs:
[ el: [ { rating: -3,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-70748.zip' } ],
ja: [ { rating: 0,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-70874.zip' } ],
es: [ { rating: 0,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-72187.zip' },
{ rating: 0,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-72188.zip' },
{ rating: -1,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-70756.zip' },
{ rating: -1,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-70742.zip' } ],
fr: [ { rating: 0,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-71642.zip' },
{ rating: -5,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-71155.zip' } ],
ar: [ { rating: 2,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-70604.zip' },
{ rating: 1,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-70753.zip' },
{ rating: 0,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-71131.zip' } ] ] }
You can filter the results by doing
YFsubs.filter(data, [languages])
languages: has to be an array of languages code
Example:
YFsubs.getSubs("0478970").then(function(data){
console.log(YFsubs.filter(data, ["en", "fr"]));
});
This will return:
Object { languages: [ 'fr', 'es' ],
subs:
[ es: [ { rating: 0,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-72187.zip' },
{ rating: 0,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-72188.zip' },
{ rating: -1,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-70756.zip' },
{ rating: -1,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-70742.zip' } ],
fr: [ { rating: 0,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-71642.zip' },
{ rating: -5,
url: 'http://www.yifysubtitles.com/subtitle-api/ant-man-yify-71155.zip' } ] ] }
getting full language name by passing its code
console.log(YFsubs.getlanguageName(languageCode))
Example:
console.log(YFsubs.getlanguageName("en"))
Will return
"english"
Tests
npm test
Dependencies
- q: A library for promises (CommonJS/Promises/A,B,D)
- request: Simplified HTTP request client.
- underscore: JavaScript's functional programming helper library.
License
GPL-3.0