geesawra.industries/hydraulophone
An unofficial YouTube Music app for iPhone, iPad, and Mac.
0
0
# Anonymous visitor context
Hydraulophone prepares an anonymous visitor context only for playback. The
playback caller invokes `InnerTubeClient.preparePlaybackContext()` before
resolving a player stream. `configurationSnapshot()` does not start this
bootstrap, so logged-out search and library requests do not acquire a new
network dependency.
## Observed protocol behavior
The implementation is based on the pinned AuraMusic observation at
[`185a77d31733047de06cbec619d40731755a0ec1`](https://github.com/TeamAuraMusic/AuraMusic/tree/185a77d31733047de06cbec619d40731755a0ec1),
specifically the [`YouTube.kt` visitor-data
access](https://github.com/TeamAuraMusic/AuraMusic/blob/185a77d31733047de06cbec619d40731755a0ec1/innertube/src/main/kotlin/com/auramusic/innertube/YouTube.kt#L1654).
That source’s `getSwJsData` path supplies the response used by its
`visitorData` getter.
The anonymous bootstrap requests:
```text
GET https://music.youtube.com/sw.js_data
```
The response is bounded to 512 KiB, has a ten-second request timeout, and is
accepted only when the final URL remains the exact HTTPS
`music.youtube.com` API origin. The known XSSI prefix is removed before
decoding. The visitor is the first `Cgt...` or `Cgs...` string in
`response[0][2]` that satisfies the bounded, newline-free token check. The
visitor string is treated as opaque: Hydraulophone does not decode, normalize,
or re-encode it.
## Hydraulophone policy
Visitor selection is ordered as follows:
1. a valid visitor in the current `UserSession`;
2. a configured visitor in `MusicWebConfiguration` (including an offline
fixture configuration);
3. the in-memory result of the anonymous `sw.js_data` bootstrap.
The bootstrap is actor-owned and deduplicated for concurrent playback
preparation calls. Its result, including a failed attempt, is retained only in
memory for the client lifetime. `setSession(_:)` cancels the in-flight task,
increments the session generation, and clears the cached result; a result from
an older generation cannot be installed into the new session. A cancelled
caller does not cancel a shared bootstrap needed by another caller. Bootstrap
failure is surfaced as a typed `InnerTubeError`; it is not silently replaced
with a nil visitor.
The visitor is never persisted or logged. Session cookies remain Keychain-backed
credentials and are not attached to this anonymous request. Existing request
construction still gates cookies, authorization, delegated account context, and
authenticated visitor selection by the existing credential-origin and client
login policy. Supplying a visitor does not authenticate a guest profile.
## Evidence and risks
At the owner’s 18:18 simulator investigation, a restored Keychain session had
no session visitor data and no guest cookies or authorization. The anonymous
`sw.js_data` request supplied a visitor header; the resulting playback
experiments changed the tested `VISIONOS` response from unplayable to playable,
returned ranged responses for Opus probes at 0%, 65%, and 90%, and allowed the
native AAC path to begin progress at approximately 2.6 seconds instead of
10.5 seconds. This is playback evidence, not a claim that `sw.js_data` is an
official API.
`sw.js_data` and its layout are undocumented and can change without notice.
When it changes, update this adapter and capture a new sanitized observation;
do not add cookies, visitor values, response bodies, or account data to logs or
fixtures. The protocol observation is derived from AuraMusic under GPL-3.0;
this file records the source and the intentional Hydraulophone boundary rather
than making AuraMusic a runtime dependency.