Skip to content

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.

const info = await yt.getInfo(url, { signal: AbortSignal.timeout(10_000) });
import { parseVideoId } from "@distube/ytdl-core";
parseVideoId("https://youtu.be/aqz-KE-bpKQ"); // "aqz-KE-bpKQ"
parseVideoId("not a video"); // undefined