Skip to main content

Documentation

Library Exports.Channel

A YouTube channel.

Constructors

constructor

new Channel(youtube, data, full?)

Parameters

NameTypeDefault value
youtubeYouTubeundefined
dataSchema$SearchResult | Schema$Channelundefined
fullbooleanfalse

Defined in

entities/channel.ts:173

Properties

about

about: string

The description of this channel.

Defined in

entities/channel.ts:55


banner: string

The URL to the image used to generate YouTube banner images for this channel across all platforms.

Defined in

entities/channel.ts:142


country

country: string

The country this channel is based in.

Defined in

entities/channel.ts:65


customUrl

customUrl: string

This channel's custom URL, if they have one.

Defined in

entities/channel.ts:75


data

data: any

The raw data of this channel.

Defined in

entities/channel.ts:45


dateCreated

dateCreated: Date

The date this channel was created.

Defined in

entities/channel.ts:91


featuredChannels

featuredChannels: string[]

The URLs of all of this channel's featured channels. This property is broken for some channels.

Defined in

entities/channel.ts:121


full

full: boolean

Whether or not this a full channel object.

Defined in

entities/channel.ts:40


id

id: string

The ID of this channel.

Defined in

entities/channel.ts:60


keywords

keywords: string[]

This channel's keywords.

Defined in

entities/channel.ts:106


kids

kids: Object

Properties to do with videos made for children.

Type declaration

NameTypeDescription
madeForKidsbooleanWhether or not the channel is made for children.
selfDeclaredMadeForKidsbooleanWhether or not the owner of the channel marked it as made for kids.

Defined in

entities/channel.ts:161


language

language: string

The default language for this channel's uploads.

Defined in

entities/channel.ts:96


liveStatus

liveStatus: false | "live" | "upcoming"

Only set if the channel is a search result.

If the channel has an ongoing livestream, this is live. If the channel has an upcoming livestream, this is upcoming. If the channel has neither an ongoing nor upcoming livestream, this is false.

Defined in

entities/channel.ts:156


localizations

localizations: Object

The localized titles and descriptions of this channel, if any.

Index signature

[language: string]: youtube_v3.Schema$ChannelLocalization

Defined in

entities/channel.ts:147


name

name: string

The name of this channel.

Defined in

entities/channel.ts:50


playlists

playlists: PaginatedResponse\<Playlist>

The channel's playlists. Only defined when Channel.fetchPlaylists is called.

Defined in

entities/channel.ts:126


profilePictures

profilePictures: Object

This channel's profile pictures.

Type declaration

NameType
default?Thumbnail
high?Thumbnail
maxres?Thumbnail
medium?Thumbnail
standard?Thumbnail

Defined in

entities/channel.ts:80


sections

sections: ChannelSection[]

The channel's sections. Only defined when Channel.fetchSections is called.

Defined in

entities/channel.ts:136


subCount

subCount: number

The number of subscribers this channel has. -1 if the subcount is hidden.

Defined in

entities/channel.ts:116


subscriptions

subscriptions: PaginatedResponse\<Subscription>

The channel's subscriptions. Only defined when Channel.fetchSubscriptions is called.

Defined in

entities/channel.ts:131


url

url: string

The url of the channel.

Defined in

entities/channel.ts:70


videos

videos: Playlist

The channel's uploads. Only available after calling Channel.fetchVideos

Defined in

entities/channel.ts:111


views

views: number

This channel's view count.

Defined in

entities/channel.ts:101


youtube

youtube: YouTube

The YouTube object that created this channel object.

Defined in

entities/channel.ts:35


endpoint

Static endpoint: string = 'channels'

The name of the endpoint used for this entity.

Defined in

entities/channel.ts:13


fields

Static fields: string

The fields to request for this entity.

Defined in

entities/channel.ts:24


part

Static part: string = 'brandingSettings,contentDetails,localizations,snippet,statistics,status'

The parts to request for this entity.

Defined in

entities/channel.ts:18

Methods

fetch

fetch(parts?): Promise\<Channel>

Fetches this channel from the API and reassigns this object to the new channel object. Only useful if this.full is false, or if you want updated channel info.

Parameters

NameType
parts?ChannelParts

Returns

Promise\<Channel>

Defined in

entities/channel.ts:264


fetchPlaylists

fetchPlaylists(pageOptions?, parts?): Promise\<PaginatedResponse\<Playlist>>

Fetches the channel's playlists from the API and assigns them to Channel.playlists.

Parameters

NameTypeDescription
pageOptions?PageOptionsThe number of pages and maximum number of items per page. Fetches the maximum number of items allowed by the API per page by default. Set pages to a value <=0 to fetch all.
parts?PlaylistPartsThe parts of the object to fetch (saves quota if you aren't using certain properties!)

Returns

Promise\<PaginatedResponse\<Playlist>>

Defined in

entities/channel.ts:290


fetchSections

fetchSections(parts?): Promise\<ChannelSection[]>

Fetches the channel's sections from the API and assigns them to Channel.sections.

Parameters

NameType
parts?ChannelSectionParts

Returns

Promise\<ChannelSection[]>

Defined in

entities/channel.ts:310


fetchSubscriptions

fetchSubscriptions(pageOptions?, parts?): Promise\<PaginatedResponse\<Subscription>>

Fetches the channel's subscriptions from the API and assigns them to Channel.subscriptions.

Parameters

NameTypeDescription
pageOptions?PageOptionsThe number of pages and maximum number of items per page. Fetches the maximum number of items allowed by the API per page by default. Set pages to a value <=0 to fetch all.
parts?SubscriptionPartsThe parts of the object to fetch (saves quota if you aren't using certain properties!)

Returns

Promise\<PaginatedResponse\<Subscription>>

Defined in

entities/channel.ts:302


fetchVideos

fetchVideos(parts?): Promise\<Playlist>

Fetches the channel's playlist of uploads from the API and assigns it to the Channel.videos property.

Parameters

NameType
parts?PlaylistParts

Returns

Promise\<Playlist>

Defined in

entities/channel.ts:272


setBanner

setBanner(image): Promise\<Channel>

Uploads and sets the channel's banner. Must be using an access token with correct scopes.

Parameters

NameType
imageObject
image.dataBuffer
image.type"jpeg" | "png"

Returns

Promise\<Channel>

Defined in

entities/channel.ts:401


setMadeForKids

setMadeForKids(madeForKids): Promise\<Channel>

Sets whether or not the channel is made for kids. Must be using an access token with correct scopes.

Parameters

NameType
madeForKidsboolean

Returns

Promise\<Channel>

Defined in

entities/channel.ts:375


setWatermark

setWatermark(type, offset, duration, image): Promise\<void>

Sets the channel's watermark. Must be using an access token with correct scopes.

Parameters

NameType
type"fromStart" | "fromEnd"
offsetnumber
durationnumber
imageImage

Returns

Promise\<void>

Defined in

entities/channel.ts:384


subscribe

subscribe(): Promise\<Subscription>

Subscribes to the channel. Must be using an access token with correct scopes.

Returns

Promise\<Subscription>

Defined in

entities/channel.ts:319


unsetWatermark

unsetWatermark(): Promise\<void>

Unsets the channel's watermark. Must be using an access token with correct scopes.

Returns

Promise\<void>

Defined in

entities/channel.ts:393


unsubscribe

unsubscribe(subscriptionResolvable?, myId?): Promise\<void>

Unsubscribes from the channel. Must be using an access token with correct scopes.

Parameters

NameTypeDescription
subscriptionResolvable?SubscriptionResolvableThe ID or object of the subscription to remove, if you have it.
myId?stringThe ID of the authorized channel, if you have it.

Returns

Promise\<void>

Defined in

entities/channel.ts:329


updateBranding

updateBranding(branding): Promise\<Channel>

Updates the channel's branding settings. Must be using an access token with correct scopes.

Parameters

NameType
brandingChannelBrandingSettings

Returns

Promise\<Channel>

Defined in

entities/channel.ts:345


updateLocalizations

updateLocalizations(localizations): Promise\<Channel>

Updates the channel's localizations. Must be using an access token with correct scopes.

Parameters

NameType
localizationsObject

Returns

Promise\<Channel>

Defined in

entities/channel.ts:360