The Comments API fetches YouTube video comments along with their reply threads. All methods areDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/faraasaaay/innertube-v2/llms.txt
Use this file to discover all available pages before exploring further.
suspend functions on the YouTube singleton and return Result<T>.
Comments use the WEB client (not
WEB_REMIX), which enables the nested reply mechanism that YouTube Music’s internal client intentionally disables. This allows commentReplies() to retrieve full reply threads.YouTube.comments()
Fetches the first page of comment threads for a video.
The YouTube video ID (e.g.
"dQw4w9WgXcQ").How it works
- Fires a
nextrequest with the WEB client to obtain the initial comment continuation token. - The implementation searches three locations for this token in order of priority:
- Direct
continuationItemRendererin thetwoColumnWatchNextResultscontent list continuationItemRendererinsideitemSectionRenderercontents- Fallback:
engagementPanels(YouTube Music-style, no nested replies)
- Direct
- Immediately calls
commentContinuation()with that token and returns the result, so the first call returns actual comments rather than just a token.
Returns
Result<Pair<List<CommentThreadRenderer>, String?>> — a pair of:
First page of comment threads. See CommentThreadRenderer fields below.
Continuation token for
commentContinuation(). null when there are no more comments.Example
YouTube.commentContinuation()
Fetches the next page of comment threads using a continuation token.
The continuation token from a previous
comments() or commentContinuation() call.Merge strategy
The implementation merges results from two comment models to maximise accuracy:- Legacy model — standard
commentThreadRendererentries fromcontinuationItems. These carryreplies(reply thread containers). - Framework model —
commentEntityPayloadentries fromframeworkUpdates.entityBatchUpdate.mutations. These carry the canonical text content and up-to-date like/vote state that YouTube has migrated away from the legacy model.
replies field so that reply tokens are preserved.
Returns
Result<Pair<List<CommentThreadRenderer>, String?>> — same shape as comments().
YouTube.commentReplies()
Fetches replies for a comment thread.
The reply continuation token. Obtain from
CommentThreadRenderer.replies.commentRepliesRenderer.contents[].continuationItemRenderer.continuationEndpoint.continuationCommand.token, typically surfaced as the token behind a “View X replies” button.Returns
Result<Pair<List<CommentRenderer>, String?>> — a pair of:
Reply
CommentRenderer objects. Legacy and framework models are merged identically to commentContinuation(). Framework vote counts override legacy counts; legacy replyCount is preserved when present in both.Continuation token for loading more replies.
null on the last page.CommentThreadRenderer fields
CommentThreadRenderer is the top-level wrapper for a single comment thread.
Legacy comment container.
Framework-based alternative comment model.
Reply thread container.
CommentRenderer fields
CommentRenderer holds the content for a single comment or reply.
Author display name. Read the first
Run.text for the plain string.Author avatar. The list of
Thumbnail objects contains URLs at ascending resolutions; the last entry is highest quality.Comment body. Each
Run may contain a plain text segment or a linked text segment. Join all Run.text values for the full string.Relative publish time string (e.g.
"2 days ago", "3 years ago"). Read runs.firstOrNull()?.text.Navigation endpoint to the author’s channel.
Unique comment identifier. Used to deduplicate merged legacy/framework entries.
Like count as a formatted string (e.g.
"1.2K", "0"). Read runs.firstOrNull()?.text.Current user’s vote state. One of:
| Value | Meaning |
|---|---|
"UPVOTE" | The authenticated user has liked this comment |
"INDIFFERENT" | Not liked (default) |
Number of replies to this comment.
null for reply objects themselves.