Caption Core acts as an abstraction layer for Caption’s core functionality.
MIT License
npm install --save caption-core
import Caption from "caption-core";
const Caption = require("caption-core");
Caption Core is completely open-source. We've tried to make it as easy as possible to contribute. If you'd like to help out by adding sources or assisting in other parts of development, here's how to get started:
git clone [email protected]:gielcobben/caption-core.git
npm install
npm run build
node examples/search.js
.Caption currently uses 2 sources to gather subtitles. We're continuously adding sources, but the app's open-source nature also allows you to add your own when desired.
const Caption = require("caption-core");
const ENGLISH = "eng";
const LIMIT = 10;
Caption.searchByQuery("Comedians in Cars", ENGLISH, LIMIT)
.on("fastest", subtitles => {
// Fastest source has been checked.
})
.on("completed", subtitles => {
// All sources are checked.
});
[
{
name: "Comedians in Cars.HDTV.x264.srt",
download: "http://dl.opensubtitles.org/en/download/...",
extention: "",
source: "opensubtitles",
size: "",
score: 4,
},
{
name: "Comedians in Cars.1080p.WEB-DL.H264.srt",
download: "http://dl.opensubtitles.org/en/download/...",
extention: "",
source: "opensubtitles",
size: "",
score: 3,
},
];
const Caption = require("caption-core");
const ENGLISH = "eng";
const LIMIT = 10;
Caption.searchByFiles(
[
"~/Movies/Comedians in Cars.S01E01.mp4",
"~/Movies/Comedians in Cars.S01E02.mp4",
],
ENGLISH,
LIMIT,
).on("completed", subtitles => {
// All sources are checked.
});
[
{
name: "Comedians in Cars.HDTV.x264.srt",
download: "http://dl.opensubtitles.org/en/download/...",
extention: "",
source: "opensubtitles",
size: "",
score: 4,
},
{
name: "Comedians in Cars.1080p.WEB-DL.H264.srt",
download: "http://dl.opensubtitles.org/en/download/...",
extention: "",
source: "addic7ed",
size: "",
score: 3,
},
];
const Caption = require("caption-core");
Caption.download(
{
name: "Comedians in Cars.HDTV.x264.srt",
download: "http://dl.opensubtitles.org/en/download/...",
extention: "",
source: "opensubtitles",
size: "",
score: 4,
},
"opensubtitles",
"~/Movies/Comedians in Cars.S01E01.srt",
);