strawcore/src
Kayos b4286b8236 Phase 5 — PoTokenProvider trait + stream_extractor wiring
Mirrors NPE PoTokenProvider.java + PoTokenResult.java; defines the
host-injection surface for BotGuard attestation. The Rust crate stays
out of the BotGuard business — embedders (Straw on Android, future
Sulkta CLI via Browserless, etc.) supply their own impl.

src/youtube/potoken/mod.rs
  * PoTokenResult { player_request_po_token, streaming_data_po_token,
                    visitor_data }  + ::new + ::single constructors
  * PoTokenError (Unavailable, MintFailed) — FIX vs NPE: split 'declined'
    (Ok(None)) from 'errored' (Err) so callers can react differently
  * trait PoTokenProvider with 4 client-scoped methods; default impl
    returns Ok(None) so embedders can override just what they support
  * set_po_token_provider / clear_po_token_provider / po_token_provider
    static registration via RwLock<Option<Arc<dyn PoTokenProvider>>>

src/youtube/potoken/noop.rs
  * NoopPoTokenProvider — safe default

src/youtube/stream_extractor.rs
  * resolve_po_token via options-first-then-provider helper
    (options_or_provider)
  * Android branch: pulls player_request_po_token + visitor_data into
    /player body, streams streaming_data_po_token through to URL &pot=
  * iOS branch: same shape, gated on fetch_ios_client AND non-empty
    provider result

Kotlin side (PoTokenWebView lift into Straw via UniFFI's foreign-trait
bridge) is separate work — strawcore just owns the contract.

Tests: 77 lib unit pass (+4 since Phase 4) + 7 Phase 2 offline + 7
Phase 4 offline = 91 green.
2026-05-24 17:10:13 -07:00
..
downloader Phase 1 — Foundation 2026-05-24 16:32:36 -07:00
stream Phase 4 (partial) — stream value types + InnerTube /player helpers 2026-05-24 17:01:03 -07:00
youtube Phase 5 — PoTokenProvider trait + stream_extractor wiring 2026-05-24 17:10:13 -07:00
exceptions.rs Phase 4 (complete) — stream_extractor orchestrator 2026-05-24 17:08:04 -07:00
image.rs Phase 1 — Foundation 2026-05-24 16:32:36 -07:00
lib.rs Phase 4 (partial) — stream value types + InnerTube /player helpers 2026-05-24 17:01:03 -07:00
localization.rs Phase 1 — Foundation 2026-05-24 16:32:36 -07:00
metainfo.rs Phase 1 — Foundation 2026-05-24 16:32:36 -07:00
newpipe.rs Phase 1 — Foundation 2026-05-24 16:32:36 -07:00
page.rs Phase 1 — Foundation 2026-05-24 16:32:36 -07:00
service.rs Phase 1 — Foundation 2026-05-24 16:32:36 -07:00