YouTube.js
Guide
Discord
❤️ Sponsor
GitHub
Guide
Discord
❤️ Sponsor
GitHub

youtubei.js / YTNodes / CommentView

Class: CommentView

Defined in: src/parser/classes/comments/CommentView.ts:29

Extends

  • YTNode

Constructors

Constructor

new CommentView(data): CommentView

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

Parameters

data

RawNode

Returns

CommentView

Overrides

YTNode.constructor

Properties

author?

optional author: Author

Defined in: src/parser/classes/comments/CommentView.ts:62


author_is_channel_owner?

optional author_is_channel_owner: boolean

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


comment_id

comment_id: string

Defined in: src/parser/classes/comments/CommentView.ts:41


content?

optional content: Text

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


creator_thumbnail_url?

optional creator_thumbnail_url: string

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


dislike_active_tooltip?

optional dislike_active_tooltip: string

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


dislike_command?

optional dislike_command: NavigationEndpoint

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


dislike_inactive_tooltip?

optional dislike_inactive_tooltip: string

Defined in: src/parser/classes/comments/CommentView.ts:56


heart_active_tooltip?

optional heart_active_tooltip: string

Defined in: src/parser/classes/comments/CommentView.ts:57


is_disliked?

optional is_disliked: boolean

Defined in: src/parser/classes/comments/CommentView.ts:65


is_hearted?

optional is_hearted: boolean

Defined in: src/parser/classes/comments/CommentView.ts:66


is_liked?

optional is_liked: boolean

Defined in: src/parser/classes/comments/CommentView.ts:64


is_member?

optional is_member: boolean

Defined in: src/parser/classes/comments/CommentView.ts:60


is_pinned

is_pinned: boolean

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


keys

keys: CommentKeys

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


like_active_tooltip?

optional like_active_tooltip: string

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


like_button_a11y?

optional like_button_a11y: string

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


like_command?

optional like_command: NavigationEndpoint

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


like_count?

optional like_count: string

Defined in: src/parser/classes/comments/CommentView.ts:50


like_count_a11y?

optional like_count_a11y: string

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


like_count_liked?

optional like_count_liked: string

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


like_inactive_tooltip?

optional like_inactive_tooltip: string

Defined in: src/parser/classes/comments/CommentView.ts:54


member_badge?

optional member_badge: MemberBadge

Defined in: src/parser/classes/comments/CommentView.ts:61


prepare_account_command?

optional prepare_account_command: NavigationEndpoint

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


published_time?

optional published_time: string

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


reply_command?

optional reply_command: NavigationEndpoint

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


reply_count?

optional reply_count: string

Defined in: src/parser/classes/comments/CommentView.ts:58


reply_count_a11y?

optional reply_count_a11y: string

Defined in: src/parser/classes/comments/CommentView.ts:59


type

readonly type: string

Defined in: src/parser/helpers.ts:8

Inherited from

YTNode.type


undislike_command?

optional undislike_command: NavigationEndpoint

Defined in: src/parser/classes/comments/CommentView.ts:37


unlike_command?

optional unlike_command: NavigationEndpoint

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


voice_reply_container?

optional voice_reply_container: VoiceReplyContainerView | null

Defined in: src/parser/classes/comments/CommentView.ts:68


type

static type: string = 'CommentView'

Defined in: src/parser/classes/comments/CommentView.ts:30

Overrides

YTNode.type

Methods

applyMutations()

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

Defined in: src/parser/classes/comments/CommentView.ts:85

Parameters

comment?

RawNode

toolbar_state?

RawNode

toolbar_surface?

RawNode

comment_surface?

RawNode

Returns

void


as()

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

Defined in: src/parser/helpers.ts:29

Cast to one of the given types.

Type Parameters

T

T extends YTNode

K

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


dislike()

dislike(): Promise<ApiResponse>

Defined in: src/parser/classes/comments/CommentView.ts:167

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.


hasKey()

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

Defined in: src/parser/helpers.ts:41

Check for a key without asserting the type.

Type Parameters

T

T extends string

R

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


is()

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

Defined in: src/parser/helpers.ts:19

Check if the node is of the given type.

Type Parameters

T

T extends YTNode

K

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


key()

key<T, R>(key): Maybe

Defined in: src/parser/helpers.ts:51

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

Type Parameters

T

T extends string

R

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


like()

like(): Promise<ApiResponse>

Defined in: src/parser/classes/comments/CommentView.ts:149

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.


reply()

reply(comment_text): Promise<ApiResponse>

Defined in: src/parser/classes/comments/CommentView.ts:222

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.


setActions()

setActions(actions): void

Defined in: src/parser/classes/comments/CommentView.ts:273

Parameters

actions

Actions | undefined

Returns

void


translate()

translate(target_language): Promise<ApiResponse & object>

Defined in: src/parser/classes/comments/CommentView.ts:251

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.


undislike()

undislike(): Promise<ApiResponse>

Defined in: src/parser/classes/comments/CommentView.ts:203

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.


unlike()

unlike(): Promise<ApiResponse>

Defined in: src/parser/classes/comments/CommentView.ts:185

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.

Edit this page
Last Updated: 10/12/25, 3:23 PM