Class: Client
Youtube Client
Constructors
constructor
• new Client(options?)
Parameters
| Name | Type |
|---|---|
options | Partial<HTTPOptions> |
Accessors
oauth
• get oauth(): OAuthProps
Returns
Methods
findOne
▸ findOne<T>(query, options?): Promise<undefined | SearchResultItem<T["type"]>>
Search for videos / playlists / channels and returns the first result
Type parameters
| Name | Type |
|---|---|
T | extends SearchOptions |
Parameters
| Name | Type |
|---|---|
query | string |
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
| Name | Type |
|---|---|
channelId | string |
Returns
Promise<undefined | Channel>
getPlaylist
▸ getPlaylist<T>(playlistId): Promise<T>
Get playlist information and its videos by playlist id or URL
Type parameters
| Name | Type |
|---|---|
T | extends undefined | Playlist | MixPlaylist |
Parameters
| Name | Type |
|---|---|
playlistId | string |
Returns
Promise<T>
getVideo
▸ getVideo<T>(videoId): Promise<T>
Get video information by video id or URL
Type parameters
| Name | Type |
|---|---|
T | extends undefined | Video | LiveVideo |
Parameters
| Name | Type |
|---|---|
videoId | string |
Returns
Promise<T>
getVideoTranscript
▸ getVideoTranscript(videoId, languageCode?): Promise<undefined | Caption[]>
Get video transcript / caption by video id
Parameters
| Name | Type |
|---|---|
videoId | string |
languageCode? | string |
Returns
Promise<undefined | Caption[]>
search
▸ search<T>(query, options?): Promise<SearchResult<T["type"]>>
Searches for videos / playlists / channels
Type parameters
| Name | Type |
|---|---|
T | extends SearchOptions |
Parameters
| Name | Type | Description |
|---|---|---|
query | string | The search query |
options? | T | Search options |
Returns
Promise<SearchResult<T["type"]>>