Skip to content

feat(youtube): bundle po_token provider + adaptive preview (age-restricted playback)#103

Merged
windoze95 merged 1 commit into
mainfrom
feature/potoken-and-adaptive-preview
Jun 29, 2026
Merged

feat(youtube): bundle po_token provider + adaptive preview (age-restricted playback)#103
windoze95 merged 1 commit into
mainfrom
feature/potoken-and-adaptive-preview

Conversation

@windoze95

Copy link
Copy Markdown
Owner

Makes age-restricted videos play, the deepest layer of the "won't play" saga. Cookies authenticate fine, but YouTube serves the authenticated web session SABR-only formats: no progressive stream (so instant-stream can't serve them) and the adaptive URLs need a PO token to download. No single yt-dlp client gives both age-pass and a playable stream — so two pieces work together:

1. po_token (the unlock)

  • Bundle the bgutil provider (node server) into the all-in-one image via a multi-stage copy from brainicism/bgutil-ytdlp-pot-provider (Debian 12, same base; multi-arch amd64+arm64). Started by the entrypoint on 127.0.0.1:4416.
  • Add the yt-dlp plugin (bgutil-ytdlp-pot-provider) to requirements. yt-dlp then fetches a PO token automatically, making the authenticated adaptive formats downloadable.
  • Validated in the built image: provider serves (v1.3.1), plugin loads, full stack boots with Starting po_token provider....

2. Adaptive preview (the playback path)

  • download_preview now falls back to muxing a <=480p video+audio pair (--merge-output-format mp4) when there's no progressive format — so the existing cold-press → preview fallback produces a playable file for age-restricted videos. Timeout 120→300s for the full A/V pull.

Notes

  • Non-age videos unchanged (instant-stream via android client).
  • Graceful degradation: if the provider doesn't start, the plugin skips the token; non-age playback is unaffected.
  • Mechanism validated end-to-end locally (token fetch + adaptive download+merge → playable mp4). I built+booted the arm64 image; amd64 rides the same multi-arch bases and is built by CI. Final age-restricted check is on the live server (needs the real cookies).

321 passed, ruff clean.

🤖 Generated with Claude Code

…icted play)

Age-restricted videos authenticate fine (cookies pass the age gate) but YouTube
serves the authenticated web session SABR-only formats — no progressive stream,
and the plain adaptive URLs need a PO token to be downloadable. No single client
gives both age-pass and a playable stream, so instant-stream (progressive) can't
serve them. Two pieces, together, make them play:

1. po_token: bundle the bgutil provider (node server, multi-arch, started by the
   entrypoint on 127.0.0.1:4416) + the yt-dlp plugin (requirements.txt). yt-dlp
   then fetches a PO token automatically, making the authenticated adaptive
   formats downloadable. Validated in the built image: provider serves v1.3.1,
   plugin loads, full stack boots.
2. Adaptive preview: download_preview falls back to muxing a <=480p video+audio
   pair (with --merge-output-format mp4) when no progressive format exists, so
   the existing cold-press -> preview fallback yields a playable file for
   age-restricted videos. Timeout raised 120->300s for the full A/V pull.

Non-age videos are unchanged (instant-stream via the android client). Graceful
degradation: if the provider doesn't start, the plugin just skips the token and
non-age playback is unaffected. 321 passed; ruff clean; arm64 image built+booted
locally, amd64 covered by the multi-arch base images + CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@windoze95 windoze95 merged commit 093dea7 into main Jun 29, 2026
5 checks passed
@windoze95 windoze95 deleted the feature/potoken-and-adaptive-preview branch June 29, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant