ytsearch.js
YouTube Search

Video Search

Search YouTube videos and consume normalized VideoResult objects.

js
const result = await searchYouTube("React tutorial", {
  type: "video",
  limit: 20,
});

for (const video of result.videos) {
  console.log(video.id, video.title, video.duration);
}

Video result fields

FieldDescription
idYouTube video identifier.
titleVideo title.
thumbnailThumbnail URL and dimensions.
authorNormalized channel/author information when available.
viewCountNumeric view count from the normalized search response.
durationFormatted duration.
secondsDuration converted to seconds.
publishedAtPublished-time text extracted from YouTube.
isLiveWhether the normalized result is marked as live.