Skip to main content

Documentation

Library Exports.Channel

A YouTube channel.

Constructors

constructor

new Channel(youtube, data, full?)

Parameters

NameTypeDefault value
youtubeYouTubeundefined
dataanyundefined
fullbooleanfalse

Defined in

entities/channel.ts:158

Properties

about

about: string

The description of this channel.

Defined in

entities/channel.ts:51


country

country: string

The country this channel is based in.

Defined in

entities/channel.ts:61


customUrl

customUrl: string

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

Defined in

entities/channel.ts:71


data

data: any

The raw data of this channel.

Defined in

entities/channel.ts:41


dateCreated

dateCreated: Date

The date this channel was created.

Defined in

entities/channel.ts:87


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:117


full

full: boolean

Whether or not this a full channel object.

Defined in

entities/channel.ts:36


id

id: string

The ID of this channel.

Defined in

entities/channel.ts:56


keywords

keywords: string[]

This channel's keywords.

Defined in

entities/channel.ts:102


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:146


language

language: string

The default language for this channel's uploads.

Defined in

entities/channel.ts:92


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:141


name

name: string

The name of this channel.

Defined in

entities/channel.ts:46


playlists

playlists: PaginatedResponse<Playlist>

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

Defined in

entities/channel.ts:122


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:76


sections

sections: ChannelSection[]

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

Defined in

entities/channel.ts:132


subCount

subCount: number

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

Defined in

entities/channel.ts:112


subscriptions

subscriptions: PaginatedResponse<Subscription>

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

Defined in

entities/channel.ts:127


url

url: string

The url of the channel.

Defined in

entities/channel.ts:66


videos

videos: Playlist

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

Defined in

entities/channel.ts:107


views

views: number

This channel's view count.

Defined in

entities/channel.ts:97


youtube

youtube: YouTube

The YouTube object that created this channel object.

Defined in

entities/channel.ts:31


endpoint

Static endpoint: string = 'channels'

The name of the endpoint used for this entity.

Defined in

entities/channel.ts:11


fields

Static fields: string

The fields to request for this entity.

Defined in

entities/channel.ts:21


part

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

The parts to request for this entity.

Defined in

entities/channel.ts:16

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:244


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:270


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:290


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:282


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:252


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:367


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:342


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:350


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:299


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:359


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:309


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:325


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:333