Files
YouTube.js/examples/comments
LuanRT eb72c2f6ef refactor(parser): improve typings and do some refactoring (#305)
* dev: add response types

* dev: refactor `Parser#parseResponse()`

* dev: update YouTube parsers

* dev: update YouTube Music classes

* dev: update YouTube Kids classes

* dev: update core classes

* dev(Parser): fix some inconsistencies

* chore: update docs

* chore: update docs x2

* fix: export response types 

* chore(docs): update parser example
2023-02-12 07:04:17 -03:00
..

Comments

YouTube.js has full support for comments, including comment actions such as translating, liking, disliking and replying.

Usage

Get a Comments instance:

const comments = await yt.getComments(VIDEO_ID);

API

contents

A list of comment threads. Note: More about comment threads here.

Type: CommentThread[]

applySort(sort)

Applies given sort option to the comments.

Param Type Description
sort string Sort option. Can be TOP_COMMENTS, NEWEST_FIRST

Returns: Promise.<Comments>

createComment(text)

Creates a top-level comment.

Param Type Description
text string Comment content

Returns: Promise<ActionsResponse>

getContinuation()

Retrieves next batch of comment threads.

Returns: Promise.<Comments>

has_continuation

Returns whether there are more comments to be fetched.

Type: boolean

page

Returns original InnerTube response (sanitized).

Returns: ParsedResponse

Example

See index.ts.