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: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
Search for videos, movies, and other content on YouTube. Method:client.explore.search()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
keyword | string | Yes | Search keyword |
gl | string | No | Geo location code (e.g., “US”) |
hl | string | No | Language code (e.g., “en”) |
uploadDate | "1_HOUR_AGO" | "TODAY" | "THIS_WEEK" | "THIS_MONTH" | "THIS_YEAR" | No | Filter by upload date |
type | "VIDEO" | "MOVIE" | No | Content type filter |
continuation | string | No | Pagination token |
Suggestions
Get search suggestions based on a keyword to help users discover related content. Method:client.explore.suggestions()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
keyword | string | Yes | Search keyword |
gl | string | No | Geo location code |
hl | string | No | Language code |
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:
| Parameter | Type | Required | Description |
|---|---|---|---|
videoId | string | Yes | YouTube video ID |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Comments
Retrieve comments for a YouTube video with support for sorting and pagination. Method:client.video.getComments()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
videoId | string | Yes | YouTube video ID |
sortBy | "TOP_COMMENTS" | "NEWEST_FIRST" | No | Sort order for comments |
continuation | string | No | Pagination token |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Reply Comments
Retrieve reply comments for a specific parent comment. Method:client.video.getReplyComments()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
continuation | string | Yes | Continuation token from parent comment |
gl | string | No | Geo location code |
hl | string | No | Language code |
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:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | YouTube channel ID |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Videos
Retrieve all videos from a channel with pagination support. Method:client.channel.getVideos()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | YouTube channel ID |
continuation | string | No | Pagination token |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Playlists
Get all playlists created by a channel. Method:client.channel.getPlaylists()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | YouTube channel ID |
continuation | string | No | Pagination token |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Releases
Retrieve music releases and albums from a channel. Method:client.channel.getReleases()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | YouTube channel ID |
continuation | string | No | Pagination token |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Posts
Get community posts from a channel. Method:client.channel.getPosts()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | YouTube channel ID |
continuation | string | No | Pagination token |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Shorts
Retrieve YouTube Shorts from a channel. Method:client.channel.getShorts()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | YouTube channel ID |
continuation | string | No | Pagination token |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Store
Get store items and merchandise from a channel. Method:client.channel.getStore()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | YouTube channel ID |
continuation | string | No | Pagination token |
gl | string | No | Geo location code |
hl | string | No | Language code |
Search
Search for content within a specific channel. Method:client.channel.search()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | string | Yes | YouTube channel ID |
keyword | string | Yes | Search keyword |
continuation | string | No | Pagination token |
gl | string | No | Geo location code |
hl | string | No | Language code |
Trending Module
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:
| Parameter | Type | Required | Description |
|---|---|---|---|
countryCode | string | No | ISO country code (e.g., “us”) |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Top Video
Get top trending videos with chart positions and rankings. Method:client.trending.getTopVideo()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
filterByType | "DAILY" | "WEEKLY" | No | Chart type filter |
filterByDate | string | No | Date filter in YYYYMMDD format |
countryCode | string | No | ISO country code |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Song
Retrieve trending songs from YouTube Music charts. Method:client.trending.getSong()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
countryCode | string | No | ISO country code |
filterByDate | string | No | Date filter in YYYYMMDD format |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Artist
Get trending artists from YouTube Music charts. Method:client.trending.getArtist()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
countryCode | string | No | ISO country code |
filterByDate | string | No | Date filter in YYYYMMDD format |
gl | string | No | Geo location code |
hl | string | No | Language code |
Get Top Short Song
Get top trending short songs (YouTube Shorts music). Method:client.trending.getTopShortSong()
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
countryCode | string | No | ISO country code |
filterByType | "DAILY" | "WEEKLY" | No | Chart type filter |
filterByDate | string | No | Date filter in YYYYMMDD format |
gl | string | No | Geo location code |
hl | string | No | Language code |

