Getting Started
Quick Start
Search YouTube in a few lines and inspect the normalized results returned by ytsearch.js.
JavaScript / ESM
import { searchYouTube } from "ytsearch.js";
const results = await searchYouTube("JavaScript tutorial", {
type: "video",
sort: "relevance",
limit: 20,
});
console.log(results.videos);
console.log(results.metadata);Inspect the result
A search resolves to a SearchResult. It contains separate arrays for videos, channels, playlists, movies and live results, plus pagination metadata and a nextPage() method.
js
console.log(results.metadata);
console.log(results.videos[0]);Start with Search for option details, then use API Reference when you need exact signatures.