UNPKG

@yemreak/yt-dlp

Version:

Downloading videos and subtitles using yt-dlp, with utilities for extracting text from subtitles

39 lines (38 loc) 1.54 kB
/// <reference types="node" /> import type { SubtitleData, YtDlpOptions } from "./types.js"; /** * Downloads the latest release of yt-dlp from GitHub * - chmod +x the file if it's not on Windows */ export declare function downloadLatestRelease(outdir?: string): Promise<string>; export declare function execYtDlp(options: YtDlpOptions): import("child_process").PromiseWithChild<{ stdout: string; stderr: string; }>; /** * Parses the filenames from the output of yt-dlp */ export declare function parseFilenamesFromOutput(stdout: string): string[]; /** * Extracts text from subtitle data. * @param subtitleData - The subtitle data containing events with text segments. * @returns The concatenated text from all subtitles. */ export declare function extractTextFromJson3Subtitle(subtitleData: SubtitleData): string; /** * Extracts text from VTT subtitle data. * @param subtitleData - The subtitle data in VTT format. * @returns The concatenated text from all subtitles. */ export declare function extractTextFromVttSubtitle(subtitleData: string): string; /** * Cleans and extracts text from SRT subtitle data. * - Omits line numbers and timestamps. * - Consolidates multiple spaces into one. * - Converts dashes to spaces. * - Removes duplicate consecutive lines. * @param subtitleData Raw SRT subtitle content. * @returns A clean, continuous string of subtitle text. */ export declare function extractTextFromSrtSubtitle(subtitleData: string): string; export declare function isConflictError(error: any): boolean;