ytsearch.js
Guide

YouTube Video Metadata in Node.js

Fetch normalized metadata for a specific YouTube video ID.

1

Call getVideoDetails

Pass a non-empty video ID.

2

Read metadata

Use title, description, duration, views, channel, likes and privacy fields.

3

Handle errors

Catch YtSearchError for invalid IDs, parsing and network failures.

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

const video = await getVideoDetails("dQw4w9WgXcQ");

console.log(video.title);
console.log(video.channel.name);
console.log(video.views);