Skip to main content

Class: Client

Youtube Client

Constructors

constructor

new Client(options?)

Parameters

NameType
optionsPartial<HTTPOptions>

Accessors

oauth

get oauth(): OAuthProps

Returns

OAuthProps

Methods

findOne

findOne<T>(query, options?): Promise<undefined | SearchResultItem<T["type"]>>

Search for videos / playlists / channels and returns the first result

Type parameters

NameType
Textends SearchOptions

Parameters

NameType
querystring
options?T

Returns

Promise<undefined | SearchResultItem<T["type"]>>

Can be VideoCompact | PlaylistCompact | BaseChannel | undefined


getChannel

getChannel(channelId): Promise<undefined | Channel>

Get channel information by channel id+

Parameters

NameType
channelIdstring

Returns

Promise<undefined | Channel>


getPlaylist

getPlaylist<T>(playlistId): Promise<T>

Get playlist information and its videos by playlist id or URL

Type parameters

NameType
Textends undefined | Playlist | MixPlaylist

Parameters

NameType
playlistIdstring

Returns

Promise<T>


getVideo

getVideo<T>(videoId): Promise<T>

Get video information by video id or URL

Type parameters

NameType
Textends undefined | Video | LiveVideo

Parameters

NameType
videoIdstring

Returns

Promise<T>


getVideoTranscript

getVideoTranscript(videoId, languageCode?): Promise<undefined | Caption[]>

Get video transcript / caption by video id

Parameters

NameType
videoIdstring
languageCode?string

Returns

Promise<undefined | Caption[]>


search<T>(query, options?): Promise<SearchResult<T["type"]>>

Searches for videos / playlists / channels

Type parameters

NameType
Textends SearchOptions

Parameters

NameTypeDescription
querystringThe search query
options?TSearch options

Returns

Promise<SearchResult<T["type"]>>