ytsearch.js
Runtime & Language

ES Modules

Use the ESM export of ytsearch.js with import syntax.

js
import { searchYouTube } from "ytsearch.js";

const results = await searchYouTube("Black Panther", {
  type: "channel",
  limit: 10,
});

results.channels.forEach((item) => {
  console.log(item.type, item.title);
});

The package's exports map points ESM imports to dist/main.mjs.