Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

caption-core

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

caption-core

Download subtitles from multiple sources.

  • 2.2.0-beta1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
2
Weekly downloads
 
Created
Source

icon
Caption Core


banner

INTRODUCTION

Caption Core acts as an abstraction layer for Caption’s core functionality. This allows third parties to add new sources or update existing ones. By introducing a simple but powerful API, all other modules that rely on Caption’s core will be able to upgrade smoothly.

View Caption.


🛠 Install

Setup:
npm install --save caption-core
ES6
import Caption from "caption-core";
CommonJS
const Caption = require("caption-core");

⚡️ Contribute

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:

To begin working locally:
  1. Fork this repository to your own GitHub account
  2. Clone it to your local device: git clone git@github.com:gielcobben/caption-core.git
  3. Install the dependencies: npm install
  4. Build the module using Rollup: npm run build
  5. Run one of the examples: node examples/search.js.

📦 Sources

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.

Standard sources:
  • OpenSubtitles
  • Addic7ed

🔎 Search by query

Code:
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.
  });
Output:
[
  {
    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,
  },
];

🎞 Search by file

Code:
const Caption = require("caption-core");

const ENGLISH = "eng";
const LIMIT = 10;

Caption.searchByFile(
  [
    "~/Movies/Comedians in Cars.S01E01.mp4",
    "~/Movies/Comedians in Cars.S01E02.mp4",
  ],
  ENGLISH,
  LIMIT,
).on("completed", subtitles => {
  // All sources are checked.
});
Output:
[
  {
    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,
  },
];

📺 Download subtitle

Code:
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",
);

Authors:
Repositories:

🔑 License

MIT © Giel Cobben & Vernon de Goede

Keywords

FAQs

Package last updated on 20 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc