Skip to main content
@talosjs/youtube provides a Youtube class that fetches a video’s transcript — segmented text with timestamps — along with its title, author, and thumbnail, via the transcriptapi.com service. It also re-exports the option and format types from ytdlp-nodejs (YoutubeArgsOptionsType, YoutubeFormatOptionsType, YoutubeQualityOptionsType, YoutubeVideoFormatType, YoutubeVideoProgressType) for typing video download workflows built on ytdlp-nodejs directly.

Installation

Add the package with Bun.

Configuration

Youtube needs a transcript API key, either passed to the constructor or read from the YOUTUBE_TRANSCRIPT_API_KEY environment variable. The constructor throws YoutubeException (API_KEY_REQUIRED) if neither is set.

Usage

transcript(videoId) returns the transcript segments plus video metadata for a given YouTube video id.

Types

Exceptions

YoutubeException (extending Exception, mapped to InternalServerError) is thrown with a machine-readable key.