Skip to main content

YouTube API Client

A TypeScript client library for the YouTube API. This library provides easy access to YouTube search, video details, channel information, and trending content.

Installation

Install the package using npm:

Quick Start

Configuration

Configure the YouTube client with your API credentials:
Get your API key: RapidAPI - YouTube Scraper API API Documentation: ZiloData API Docs :::note The API endpoint is hardcoded and cannot be changed. :::

API Structure

The library is organized into modules, each providing specific functionality:

API Reference

Explore Module

The explore module provides search and suggestion functionality for discovering YouTube content. Search for videos, movies, and other content on YouTube. Method: client.explore.search() Parameters: Example:
Example Response:

Suggestions

Get search suggestions based on a keyword to help users discover related content. Method: client.explore.suggestions() Parameters: Example:
Example Response:

Video Module

The video module provides comprehensive access to video details, comments, and replies.

Get Detail

Get detailed information about a YouTube video including metadata, statistics, and download links. Method: client.video.getDetail() Parameters: Example:
Example Response:

Get Comments

Retrieve comments for a YouTube video with support for sorting and pagination. Method: client.video.getComments() Parameters: Example:
Example Response:

Get Reply Comments

Retrieve reply comments for a specific parent comment. Method: client.video.getReplyComments() Parameters: Example:

Channel Module

The channel module provides access to channel information, videos, playlists, and other channel-related content.

Get Detail

Get comprehensive information about a YouTube channel including statistics, metadata, and verification status. Method: client.channel.getDetail() Parameters: Example:
Example Response:

Get Videos

Retrieve all videos from a channel with pagination support. Method: client.channel.getVideos() Parameters: Example:

Get Playlists

Get all playlists created by a channel. Method: client.channel.getPlaylists() Parameters: Example:

Get Releases

Retrieve music releases and albums from a channel. Method: client.channel.getReleases() Parameters: Example:

Get Posts

Get community posts from a channel. Method: client.channel.getPosts() Parameters: Example:

Get Shorts

Retrieve YouTube Shorts from a channel. Method: client.channel.getShorts() Parameters: Example:

Get Store

Get store items and merchandise from a channel. Method: client.channel.getStore() Parameters: Example:

Search

Search for content within a specific channel. Method: client.channel.search() Parameters: Example:
The trending module provides access to trending videos, songs, artists, and charts from YouTube.

Get Video

Get trending videos for a specific country. Method: client.trending.getVideo() Parameters: Example:
Example Response:

Get Top Video

Get top trending videos with chart positions and rankings. Method: client.trending.getTopVideo() Parameters: Example:

Get Song

Retrieve trending songs from YouTube Music charts. Method: client.trending.getSong() Parameters: Example:

Get Artist

Get trending artists from YouTube Music charts. Method: client.trending.getArtist() Parameters: Example:

Get Top Short Song

Get top trending short songs (YouTube Shorts music). Method: client.trending.getTopShortSong() Parameters: Example:

Error Handling

The client uses axios for HTTP requests. Errors will be thrown as axios errors with detailed information:

Additional Resources