YouTube.js
Guide
Discord
GitHub
Guide
Discord
GitHub

youtubei.js / YTNodes / CommentView

Class: CommentView

Extends

  • YTNode

Constructors

new CommentView()

new CommentView(data): CommentView

Parameters

• data: RawNode

Returns

CommentView

Overrides

YTNode.constructor

Defined in

src/parser/classes/comments/CommentView.ts:55

Properties

author?

optional author: Author

Defined in

src/parser/classes/comments/CommentView.ts:49


author_is_channel_owner?

optional author_is_channel_owner: boolean

Defined in

src/parser/classes/comments/CommentView.ts:44


comment_id

comment_id: string

Defined in

src/parser/classes/comments/CommentView.ts:38


content?

optional content: Text

Defined in

src/parser/classes/comments/CommentView.ts:42


dislike_command?

optional dislike_command: NavigationEndpoint

Defined in

src/parser/classes/comments/CommentView.ts:33


is_disliked?

optional is_disliked: boolean

Defined in

src/parser/classes/comments/CommentView.ts:52


is_hearted?

optional is_hearted: boolean

Defined in

src/parser/classes/comments/CommentView.ts:53


is_liked?

optional is_liked: boolean

Defined in

src/parser/classes/comments/CommentView.ts:51


is_member?

optional is_member: boolean

Defined in

src/parser/classes/comments/CommentView.ts:47


is_pinned

is_pinned: boolean

Defined in

src/parser/classes/comments/CommentView.ts:39


keys

keys: CommentKeys

Defined in

src/parser/classes/comments/CommentView.ts:40


like_command?

optional like_command: NavigationEndpoint

Defined in

src/parser/classes/comments/CommentView.ts:32


like_count?

optional like_count: string

Defined in

src/parser/classes/comments/CommentView.ts:45


member_badge?

optional member_badge: MemberBadge

Defined in

src/parser/classes/comments/CommentView.ts:48


published_time?

optional published_time: string

Defined in

src/parser/classes/comments/CommentView.ts:43


reply_command?

optional reply_command: NavigationEndpoint

Defined in

src/parser/classes/comments/CommentView.ts:36


reply_count?

optional reply_count: string

Defined in

src/parser/classes/comments/CommentView.ts:46


type

readonly type: string

Inherited from

YTNode.type

Defined in

src/parser/helpers.ts:8


undislike_command?

optional undislike_command: NavigationEndpoint

Defined in

src/parser/classes/comments/CommentView.ts:35


unlike_command?

optional unlike_command: NavigationEndpoint

Defined in

src/parser/classes/comments/CommentView.ts:34


type

static type: string = 'CommentView'

Overrides

YTNode.type

Defined in

src/parser/classes/comments/CommentView.ts:28

Methods

applyMutations()

applyMutations(comment?, toolbar_state?, toolbar_surface?): void

Parameters

• comment?: RawNode

• toolbar_state?: RawNode

• toolbar_surface?: RawNode

Returns

void

Defined in

src/parser/classes/comments/CommentView.ts:70


as()

as<T, K>(...types): InstanceType<K[number]>

Cast to one of the given types.

Type Parameters

• T extends YTNode

• K extends YTNodeConstructor<T>[]

Parameters

• ...types: K

The types to cast to

Returns

InstanceType<K[number]>

The node cast to one of the given types

Throws

If the node is not of the given type

Inherited from

YTNode.as

Defined in

src/parser/helpers.ts:38


dislike()

dislike(): Promise<ApiResponse>

Dislikes the comment.

Returns

Promise<ApiResponse>

A promise that resolves to the API response.

Throws

If the Actions instance is not set for this comment or if the dislike command is not found.

Defined in

src/parser/classes/comments/CommentView.ts:132


hasKey()

hasKey<T, R>(key): this is CommentView & { [k in string]: R }

Check for a key without asserting the type.

Type Parameters

• T extends string

• R = any

Parameters

• key: T

The key to check

Returns

this is CommentView & { [k in string]: R }

Whether the node has the key

Inherited from

YTNode.hasKey

Defined in

src/parser/helpers.ts:50


is()

is<T, K>(...types): this is InstanceType<K[number]>

Check if the node is of the given type.

Type Parameters

• T extends YTNode

• K extends YTNodeConstructor<T>[]

Parameters

• ...types: K

The type to check

Returns

this is InstanceType<K[number]>

whether the node is of the given type

Inherited from

YTNode.is

Defined in

src/parser/helpers.ts:28


key()

key<T, R>(key): Maybe

Assert that the node has the given key and return it.

Type Parameters

• T extends string

• R = any

Parameters

• key: T

The key to check

Returns

Maybe

The value of the key wrapped in a Maybe

Throws

If the node does not have the key

Inherited from

YTNode.key

Defined in

src/parser/helpers.ts:60


like()

like(): Promise<ApiResponse>

Likes the comment.

Returns

Promise<ApiResponse>

A promise that resolves to the API response.

Throws

If the Actions instance is not set for this comment or if the like command is not found.

Defined in

src/parser/classes/comments/CommentView.ts:114


reply()

reply(comment_text): Promise<ApiResponse>

Replies to the comment.

Parameters

• comment_text: string

The text of the reply.

Returns

Promise<ApiResponse>

A promise that resolves to the API response.

Throws

If the Actions instance is not set for this comment or if the reply command is not found.

Defined in

src/parser/classes/comments/CommentView.ts:187


setActions()

setActions(actions): void

Parameters

• actions: undefined | Actions

Returns

void

Defined in

src/parser/classes/comments/CommentView.ts:238


translate()

translate(target_language): Promise<ApiResponse & object>

Translates the comment to the specified target language.

Parameters

• target_language: string

The target language to translate the comment to, e.g. 'en', 'ja'.

Returns

Promise<ApiResponse & object>

Resolves to an ApiResponse object with the translated content, if available.

Throws

if the Actions instance is not set for this comment or if the comment content is not found.

Defined in

src/parser/classes/comments/CommentView.ts:216


undislike()

undislike(): Promise<ApiResponse>

Undislikes the comment.

Returns

Promise<ApiResponse>

A promise that resolves to the API response.

Throws

If the Actions instance is not set for this comment or if the undislike command is not found.

Defined in

src/parser/classes/comments/CommentView.ts:168


unlike()

unlike(): Promise<ApiResponse>

Unlikes the comment.

Returns

Promise<ApiResponse>

A promise that resolves to the API response.

Throws

If the Actions instance is not set for this comment or if the unlike command is not found.

Defined in

src/parser/classes/comments/CommentView.ts:150

Edit this page
Last Updated:: 3/25/25, 8:08 PM
Contributors: EdamAme-x