geesawra.industries/hydraulophone
An unofficial YouTube Music app for iPhone, iPad, and Mac.
InnerTube adapter provenance and request contract
Hydraulophone's InnerTube adapter is a Swift implementation of the request
boundary observed in AuraMusic, pinned to
185a77d31733047de06cbec619d40731755a0ec1.
The primary source files consulted were
InnerTube.kt,
YouTube.kt,
YouTubeClient.kt,
and the request body models under
innertube/models/body.
Request contract
The default adapter uses AuraMusic's pinned WEB_REMIX identity
(1.20260315.01.00, client ID 67) and posts directly; it does not bootstrap
by loading the Music homepage. MusicWebConfiguration.parse(from:) remains an
explicit utility for callers that deliberately provide a reviewed runtime
configuration. InnerTube requests:
POST https://music.youtube.com/youtubei/v1/{endpoint}?prettyPrint=false(withkey=…only when explicitly configured)- send JSON with the operation fields and a
contextcontaining the WEB_REMIX client fields,request.internalExperimentFlags = [],request.useSsl = true, anduser.lockedSafetyMode = false; - send
X-Goog-Api-Format-Version: 1, client name/version, Music origin and referer, the visitor ID when available, and the AuraMusic-compatible web user-agent; - use the SAPISID hash only when the operation requested login, the selected
client declares
loginSupported, and the session containsSAPISID.
The key query is omitted when no key is explicitly configured, matching the
pinned AuraMusic transport.
The default transport uses an ephemeral URLSession with no cookie storage
or cache. Requests disable automatic cookie handling; the UserSession is the
only source for explicitly attached authenticated cookies. The adapter only
attaches credentials for the HTTPS music.youtube.com origin.
IOS is a playback client and intentionally has loginSupported = false.
Even if an authenticated app session exists, an IOS player request does not
receive its cookies, Authorization, or onBehalfOfUser context. This is a
protocol client-policy difference, not an attempt to bypass account
authentication for WEB_REMIX library operations.
Supported operation boundaries
- Search uses WEB_REMIX without login.
- Authenticated library playlists use
browseId = FEmusic_liked_playlists.FEmusic_likedis not the playlist tab and is not used by this adapter. - A playlist page is browsed through
VL<playlistId>, matching AuraMusic'sYouTube.playlistoperation. Domain playlist IDs are canonicalized by removing a leadingVLwhen decoding search/library renderers; callers that provide aVLID remain supported. - Player requests include
videoId,contentCheckOk, andracyCheckOk. Stream selection is separate from decoding and accepts only directaudio/mp4formats explicitly carrying anmp4acodec, ranked by bitrate; for the selected format, the adapter readsapproxDurationMsas authoritative track metadata and falls back tovideoDetails.lengthSecondswhen that value is missing or invalid. This duration is carried separately from AVPlayer's parsed duration: it describes the complete track, but does not prove that a network-backed asset has parsed or can seek through every byte. These fields and the duration fallback follow the player response shape used by AuraMusic's pinnedYTPlayerUtils.ktsource; Hydraulophone's Swift parser is an independent defensive adapter. WebM/Opus-only responses are unavailable for native playback. Following AuraMusic'sYTPlayerUtilsat the pinned commit, direct-audio resolution tries the finite sequenceVISIONOS,ANDROID_VR 1.65.10,ANDROID_VR 1.61.48(no-auth),IPADOS, authenticated-capableWEB_REMIX,ANDROIDno-SDK, and anonymousANDROID. Each candidate is requested at most once and a Google Video Server URL receives one bounded ranged liveness check before being returned. The probe uses the selected profile's user-agent plus the Range request header, with no Origin, Referer, or cookies, matching the public AVURLAsset user-agent option rather than AuraMusic's ExoPlayer custom profile headers. A failed/expired URL advances to a fresh player response for the next profile. - Media URLs are accepted only over HTTPS from
googlevideo.comor a strict*.googlevideo.comsubdomain, or from an approved YouTube/videoplaybackpath. Lookalike hosts, HTTP URLs, localhost, and unsupported redirect destinations are rejected before AVPlayer receives them. - Guest profiles never receive account cookies, SAPISID authorization, or
onBehalfOfUser. The WEB_REMIX candidate is the only profile in this sequence that can use the app session. Official non-login restrictions (private, paid, age/content checks, and unplayable statuses) stop the sequence; a boundedLOGIN_REQUIREDprogression may reach authenticated WEB_REMIX. - Cipher-only formats are reported as unavailable. Hydraulophone Core does not
currently contain a NewPipe player-JS decipherer or a BotGuard/PO-token
provider, so a live response that requires either remains a known playback
limitation rather than triggering an invented URL transformation.
WEB_REMIXretains AuraMusic'suseSignatureTimestampanduseWebPoTokensprofile policy, but nosignatureTimestampor PO token is manufactured when the corresponding provider is unavailable.
Session identity migration
The authenticated snapshot stores cookies, DATASYNC_ID, and (when captured
by the login WebView) VISITOR_DATA together in UserSession. AuraMusic's
pinned YouTubeClient.toContext passes dataSyncId directly to
onBehalfOfUser; it does not split or manufacture components at the
InnerTube boundary. DATASYNC_ID is therefore treated as opaque, including
any || components. This intentionally removes the previous Hydraulophone
prefix normalization. Existing Keychain records still decode without a
re-login: records already containing a prefix remain usable as captured, while
new login snapshots retain the full value. Authenticated WEB_REMIX requests
use the session visitor value when available; anonymous and non-login clients
use the anonymous web configuration visitor value.
Hydraulophone intentionally diverges from AuraMusic at this account-context
boundary. In simulator acceptance at 12:38–12:40 on the current pinned
configuration, the same restored cookie/visitor session succeeded with
DATASYNC_ID omitted (search=17, playlists=11, tracks=100), while
sending the full raw value caused the authenticated browse request to return
HTTP 500 with the safe backendError category. Therefore raw DATASYNC is
retained only for Keychain provenance/migration; onBehalfOfUser is emitted
only from an explicitly captured DELEGATED_SESSION_ID. When that field is
absent, the user context omits onBehalfOfUser rather than deriving a
primary/brand mapping from ||.
Error and retry policy
The adapter retries only cancellation-safe transient URLSession transport
errors, at most twice after the initial request, with 500 ms and 1 s delays.
HTTP errors are not retried. Diagnostics classify only allowlisted status,
canonical category, and reason fields; cookies, authorization values, request
bodies, response bodies, account data, and media URLs are never logged. Player
diagnostics additionally report only whether an HLS manifest exists and capped
counts of adaptive formats, direct AAC formats, and ciphered AAC formats.
Native iOS boundary and update risks
This is not an official YouTube API. InnerTube is undocumented and can change
without notice. The request/body models are adapted to Swift value types rather
than copied Kotlin source; the protocol-sensitive choices above are retained
with GPL-3.0 provenance to AuraMusic. iOS uses URLSession and structured
concurrency instead of Ktor/OkHttp. A ranged probe only proves CDN HTTP
liveness, not AVPlayer decode/readiness; the playback worker owns AVPlayer,
should pass ResolvedAudioStream.userAgent through Apple's public
AVURLAssetHTTPUserAgentKey, observe readiness/time advancement, and may call
StreamRefreshingMusicService.refreshStream(for:) once after an item failure.
The refresh cursor is ephemeral and keyed to the song's last selected profile;
it starts strictly after that profile, never persists the media URL, and marks
the finite candidate list exhausted after one failed refresh. It must validate
audio/session behavior on a physical iPhone; simulator success is not evidence
for background playback.