Get info
const info = await yt.getInfo("aqz-KE-bpKQ");
info.videoDetails.title;info.videoDetails.lengthSeconds;info.videoDetails.author.name;info.videoDetails.chapters; // [{ title, startTime }]info.formats;info.relatedVideos;Fields YouTube leaves out are undefined, and missing lists are empty.
relatedVideos holds VideoSummary values. To get them without a player lookup, call getRelated.
Everything getInfo returns is listed in VideoInfo, VideoDetails and VideoFormat.
A format whose url is undefined is served only through SABR. download still streams it.
Cancel a lookup
Section titled “Cancel a lookup”const info = await yt.getInfo(url, { signal: AbortSignal.timeout(10_000) });Parse a video ID
Section titled “Parse a video ID”import { parseVideoId } from "@distube/ytdl-core";
parseVideoId("https://youtu.be/aqz-KE-bpKQ"); // "aqz-KE-bpKQ"parseVideoId("not a video"); // undefined