Documentation 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.
Overview
YouTube’s InnerTube API does not use page numbers or offset-based pagination. Instead, every large result set is paginated using opaque continuation tokens — base64-encoded strings that encode cursor state on YouTube’s servers. You never parse or construct these strings; you simply pass them back to the appropriate*Continuation method to receive the next batch of results.
The pagination contract is simple:
- Every page object that supports pagination exposes a
continuation: String?field. - When
continuationis non-null, there is at least one more page available. - When
continuationis null, you have reached the last page.
Continuation Pairs
Each paginated resource has a dedicated pair of methods: an initial fetch and a continuation fetch.Search
SearchResult carries:
Playlist Songs
PlaylistContinuationPage carries:
Artist Items
ArtistItemsContinuationPage carries:
Library
LibraryContinuationPage carries:
Home Feed
The home feed uses an inline continuation — you pass the token as a parameter to the same method rather than calling a separate*Continuation function:
Next / Up-Next Queue
Like the home feed,next() accepts a continuation parameter directly:
Comments
Comments use a three-level continuation chain: initial load → more comment pages → reply pages.Complete Example: Fetching All Songs in a Playlist
The following coroutine iterates through every page of a playlist by looping onplaylistContinuation until no more pages remain:
Fetch the first page
Call
YouTube.playlist(playlistId) to get the PlaylistPage. The first batch of songs and an initial continuation token (if there are more pages) are returned.Collect songs and check continuation
Extract the
songs from PlaylistPage and inspect playlist.continuation (or the continuation on the inner song shelf). If non-null, there are more songs to load.Loop safety: Always check that
continuation != null before making another request. Additionally, track seen tokens with a Set<String> to guard against the rare case where the API returns the same token twice in a cycle — this is the same pattern used internally by YouTube.albumSongs(), which also caps iterations at 50 requests (maxRequests = 50) to prevent runaway API consumption on very large collections.Summary Table
| Method pair | Token field | Return type |
|---|---|---|
search() → searchContinuation(token) | SearchResult.continuation | SearchResult |
playlist() → playlistContinuation(token) | PlaylistContinuationPage.continuation | PlaylistContinuationPage |
artistItems() → artistItemsContinuation(token) | ArtistItemsContinuationPage.continuation | ArtistItemsContinuationPage |
library() → libraryContinuation(token) | LibraryContinuationPage.continuation | LibraryContinuationPage |
home(continuation = token) | HomePage.continuation | HomePage |
next(continuation = token) | NextResult.continuation | NextResult |
comments() → commentContinuation(token) | Second value of Pair | Pair<List<CommentThreadRenderer>, String?> |
commentContinuation(token) → commentReplies(replyToken) | Reply token from thread | Pair<List<CommentRenderer>, String?> |