@os-team/youtube-captions
TypeScript icon, indicating that this package has built-in type declarations

3.1.1 • Public • Published

@os-team/youtube-captions NPM version BundlePhobia

Extracts video subtitles from YouTube using the yt-dlp.

Installation

Install the package using the following command:

yarn add @os-team/youtube-captions

The library uses yt-dlp, so you need to install it in one of the following ways.

Usage

Example for getting subtitles for the video:

import { getCaptions, getLanguages } from '@os-team/youtube-captions';

const youtubeId = 'R7p-nPg8t_g';
const languages = getLanguages(youtubeId); // ['en', 'de', 'pl', 'pt', 'es']
const captions = await getCaptions(youtubeId, 'en'); // [{ start: 0, end: 1000, text: 'subtitle' }]

The start and end fields are measured in milliseconds.

Readme

Keywords

none

Package Sidebar

Install

npm i @os-team/youtube-captions

Weekly Downloads

343

Version

3.1.1

License

MIT

Unpacked Size

9.66 kB

Total Files

15

Last publish

Collaborators

  • oxilor