New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

yt-transcript-api

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yt-transcript-api

A lightweight JavaScript API and CLI for retrieving YouTube video transcripts and subtitles (including auto-generated and translated ones). No headless browsers required.

Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
51
-27.14%
Maintainers
1
Weekly downloads
 
Created
Source

✨ YT-TRANSCRIPT-API ✨

NPM Version NPM Downloads

A lightweight JavaScript API and CLI for retrieving YouTube video transcripts and subtitles (including auto-generated and translated ones). No headless browsers required.

Author: Chintamani Pala

Features

  • Fetch YouTube video transcripts (captions/subtitles) via API or CLI.
  • Supports auto-generated and manually created transcripts.
  • Supports translation (where available).
  • No browser automation or scraping required.
  • Proxy support for bypassing IP blocks.
  • Multiple output formats: JSON, text, SRT, WebVTT, pretty-print.

Installation

npm install yt-transcript-api

Or clone this repository and install dependencies:

git clone https://github.com/chintamani-pala/yt-transcript-api.git
cd yt-transcript-api
npm install

Usage

As a Library (API)

const {
  YouTubeTranscriptApi,
  TranscriptListFetcher,
  ProxyConfig,
  GenericProxyConfig,
  WebshareProxyConfig,
  InvalidProxyConfig,
  formatters,
  errors,
  settings
} = require('yt-transcript-api');

const ytt_api = new YouTubeTranscriptApi();
const video_id = '0Okxsszt624';

ytt_api.fetch(video_id, ['en']).then(transcript => {
    console.log(transcript);
}).catch(err => {
    console.error(err);
});

API Exports

  • YouTubeTranscriptApi - Main API class
  • YouTubeTranscriptCli - CLI class
  • TranscriptListFetcher - Fetches transcript lists
  • ProxyConfig, GenericProxyConfig, WebshareProxyConfig, InvalidProxyConfig - Proxy support
  • formatters - Output formatters (JSON, SRT, WebVTT, etc.)
  • errors - Custom error classes
  • settings - Internal constants

CLI Usage

You can use the CLI to fetch transcripts directly from the terminal.

npx yt-transcript-api --video-ids=0Okxsszt624 --format=json

CLI Options

  • --video-ids (comma-separated list or positional arguments)
  • --format (json, pretty, text, srt, webvtt)
    Default: pretty
  • --languages (comma-separated, e.g. en,hi)
  • --excludeManuallyCreated
  • --excludeGenerated
  • --httpProxy
  • --httpsProxy
  • --webshareProxyUsername
  • --webshareProxyPassword
  • --preserveFormatting

Example

npx yt-transcript-api --video-ids=0Okxsszt624 --format=json

Proxy Support

You can use proxies to bypass IP blocks.
Supports generic HTTP/HTTPS proxies and Webshare rotating residential proxies.

Example:

const { GenericProxyConfig, YouTubeTranscriptApi } = require('yt-transcript-api');
const proxyConfig = new GenericProxyConfig('http://your-proxy:port');
const ytt_api = new YouTubeTranscriptApi({ proxyConfig });

Output Formats

  • pretty: Node.js util.inspect
  • json: Raw JSON
  • text: Plain text
  • srt: SubRip Subtitle
  • webvtt: Web Video Text Tracks

License

MIT

Author

Chintamani Pala

Keywords

youtube

FAQs

Package last updated on 04 Jul 2025

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