# Catalog pagination protocol note Hydraulophone's catalog adapter is a small, fixture-tested Swift boundary around the observed InnerTube shapes used by AuraMusic. It is not an official YouTube Music API and does not depend on AuraMusic at runtime. ## Pinned reference The request and response shapes were compared with [AuraMusic `YouTube.kt`](https://github.com/TeamAuraMusic/AuraMusic/blob/185a77d31733047de06cbec619d40731755a0ec1/innertube/src/main/kotlin/com/auramusic/innertube/YouTube.kt) at commit `185a77d31733047de06cbec619d40731755a0ec1` (the pinned source revision supplied for the catalog slice), specifically: - `search` and `searchContinuation` (lines 413–437); - `home` and `homeContinuation` (lines 777–808); - `library` and `libraryContinuation` (lines 924–988); - `playlist` and `playlistContinuation` (lines 685–769); - `album` and album track browsing (lines 440–530). The reference implementation is GPL-3.0. Hydraulophone reimplements the observed boundary in Swift; no Kotlin source is copied into the catalog adapter. ## Request choices - Search's initial query is a JSON `query` value. Search continuation tokens are opaque URL query values under both `continuation` and `ctoken`; they are not put in the JSON body. - Browse continuations keep the token in JSON. Playlist continuation requests explicitly carry an empty `browseId`, while the initial playlist request uses `VL`. - Home uses `FEmusic_home` and passes an optional filter `params` value. `HomeAudience.authenticated` intentionally opts into the authenticated session transport. Anonymous Home prepares the same memory-only visitor context used for guest playback, so the first page and its continuation have a stable visitor. This does not enable Cookie, Authorization or delegation. - Library categories use the IDs selected by AuraMusic's authenticated library adapter: Playlists `FEmusic_liked_playlists`, Songs `FEmusic_liked_videos`, Albums `FEmusic_liked_albums`, and Artists `FEmusic_library_corpus_artists`. These are saved-library categories; the Songs category is not a substitute for a separately curated Liked Songs playlist. Requests use authenticated transport. - Album browse IDs are used as received (without adding `VL`). An album may expose a backing playlist ID as metadata, but that does not rewrite its browse ID. - Catalog requests always use the existing no-cookie-by-default transport policy. Session cookies and SAPISID authorization can only be added by the existing authenticated session path. This layer does not cache responses or direct media URLs; the cache wrapper owns catalog policy. ## Response choices The library parser accepts initial `gridRenderer.items` and `musicShelfRenderer.contents`, plus continuation `gridContinuation.items`, `musicShelfContinuation.contents`, and append-action continuation items. It classifies cards by the selected library category and the observed renderer shape: responsive songs, two-row playlists/albums/artists, and responsive library artist rows. The Library UI keeps its existing playlist grid/list and adds song playback rows, album links to the existing track view, and artist rows. The parser scopes item and continuation extraction to the operation's content container. It accepts the observed `nextContinuationData`, `nextRadioContinuationData`, and `continuationItemRenderer.continuationEndpoint.continuationCommand` forms, preserving token strings exactly and returning no next page for an empty item page, an empty token, or a missing token. Initial playlist and album track pages prefer the songs shelf's inline continuation, with the enclosing secondary section-list token as fallback for current two-column layouts. For track pages, the adapter also accepts an initial shelf's inline `continuationItemRenderer`, a direct `musicPlaylistShelfContinuation` or `musicShelfContinuation`, a `sectionListContinuation` containing nested shelves (including its enclosing token), and `appendContinuationItemsAction.continuationItems`. A section-list envelope and append action are combined when both are present. These forms are scoped to the requested operation; the section-list's enclosing continuation is preferred when it is present. A missing or wrong continuation envelope is a typed `InnerTubeError.invalidResponse`, while a recognized empty envelope is a normal terminal page. Home sections receive deterministic local IDs based on audience, response chunk, and section position/type rather than localized titles alone. Initial search walks every tab's `sectionListRenderer`; its next token comes from the last shelf that contributed accepted results, not from an empty trailing shelf. Home continuation pages accept both section-list and append-action containers, including carousel continuation shelves in either container. Each continuation chunk receives a namespace containing an internal SHA-256 digest of the input token, so unrelated pages cannot merge merely because they share an audience prefix. The raw opaque token is never logged or placed in a section ID. Home items are limited to songs, playlists, and explicitly classified `MUSIC_PAGE_TYPE_ALBUM` cards; artist and other unsupported cards are omitted. Unknown optional fields and renderers are ignored. A malformed top-level or operation-specific response remains a typed `InnerTubeError.invalidResponse`. Album track requests prefer a supplied backing playlist ID through the existing playlist-track request path (`VL` initially); the album's raw browse ID remains the fallback when no backing ID is present. Fixtures and tests use synthetic IDs, titles, tokens, and URLs only. They do not contain cookies, account responses, visitor data, authorization values, or live endpoint calls. Do not log request bodies, session material, opaque continuation tokens, or media URLs when updating this adapter. ## Simulator observations — 2026-09-23 A bounded read-only app diagnostic identified current layout variants absent from the first adapter: initial search uses `itemSectionRenderer` and `musicCardShelfRenderer`, and initial playlist tracks can place the next token on their enclosing secondary `sectionListRenderer`. The parser accepts these scoped containers without reverting to a recursive whole-response token search. Two synthetic tests reproduce those structures with invented values. Anonymous Home initially returned content but rejected its continuation. Preparing the existing anonymous visitor context before its first request made that continuation work without account credentials. At 00:36 the app diagnostic passed: anonymous Home 14 items plus 14 on the next page; authenticated Home 41 plus 59; search 17; library 11; playlist tracks 100 plus 7; and an album detail returned one track. Search/library in this response had no next token, so their continuation paths remain covered by offline fixtures rather than this live run. Counts are bounded evidence, not a guarantee about other accounts, locales or future layouts. Run `just simulator-smoke-catalog` explicitly to repeat the read-only check. It makes at most 14 catalog page calls plus the optional anonymous visitor bootstrap, does not mutate the session or play media, and logs only counts, timings, booleans and typed categories. Temporary shape-inspection code used to diagnose these layouts was removed afterward; no account payload was saved.