youtubei.js / YTNodes / CommentView
Class: CommentView
Extends
Constructors
new CommentView()
new CommentView(
data
):CommentView
Parameters
• data: RawNode
Returns
Overrides
Defined in
src/parser/classes/comments/CommentView.ts:50
Properties
author?
optional
author:Author
Defined in
src/parser/classes/comments/CommentView.ts:44
author_is_channel_owner?
optional
author_is_channel_owner:boolean
Defined in
src/parser/classes/comments/CommentView.ts:36
comment_id
comment_id:
string
Defined in
src/parser/classes/comments/CommentView.ts:24
content?
optional
content:Text
Defined in
src/parser/classes/comments/CommentView.ts:34
dislike_command?
optional
dislike_command:NavigationEndpoint
Defined in
src/parser/classes/comments/CommentView.ts:19
is_disliked?
optional
is_disliked:boolean
Defined in
src/parser/classes/comments/CommentView.ts:47
is_hearted?
optional
is_hearted:boolean
Defined in
src/parser/classes/comments/CommentView.ts:48
is_liked?
optional
is_liked:boolean
Defined in
src/parser/classes/comments/CommentView.ts:46
is_member?
optional
is_member:boolean
Defined in
src/parser/classes/comments/CommentView.ts:39
is_pinned
is_pinned:
boolean
Defined in
src/parser/classes/comments/CommentView.ts:25
keys
keys:
object
comment
comment:
string
comment_surface
comment_surface:
string
shared
shared:
string
toolbar_state
toolbar_state:
string
toolbar_surface
toolbar_surface:
string
Defined in
src/parser/classes/comments/CommentView.ts:26
like_command?
optional
like_command:NavigationEndpoint
Defined in
src/parser/classes/comments/CommentView.ts:18
like_count?
optional
like_count:string
Defined in
src/parser/classes/comments/CommentView.ts:37
member_badge?
optional
member_badge:object
a11y
a11y:
string
url
url:
string
Defined in
src/parser/classes/comments/CommentView.ts:40
published_time?
optional
published_time:string
Defined in
src/parser/classes/comments/CommentView.ts:35
reply_command?
optional
reply_command:NavigationEndpoint
Defined in
src/parser/classes/comments/CommentView.ts:22
reply_count?
optional
reply_count:string
Defined in
src/parser/classes/comments/CommentView.ts:38
type
readonly
type:string
Inherited from
Defined in
undislike_command?
optional
undislike_command:NavigationEndpoint
Defined in
src/parser/classes/comments/CommentView.ts:21
unlike_command?
optional
unlike_command:NavigationEndpoint
Defined in
src/parser/classes/comments/CommentView.ts:20
type
static
type:string
='CommentView'
Overrides
Defined in
src/parser/classes/comments/CommentView.ts:14
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:65
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
Returns
InstanceType
<K
[number
]>
Inherited from
Defined in
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:127
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
Defined in
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
Defined in
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
The value of the key wrapped in a Maybe
Throws
If the node does not have the key
Inherited from
Defined in
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:109
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:182
setActions()
setActions(
actions
):void
Parameters
• actions: undefined
| Actions
Returns
void
Defined in
src/parser/classes/comments/CommentView.ts:236
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
>
A Promise that 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:211
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:163
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.