YouTube 2.0.0: native client without ads
All checks were successful
release / release (push) Successful in 10m13s
All checks were successful
release / release (push) Successful in 10m13s
Replaces the web app (youtube.com/tv in Chromium) with a native Rust + Slint client on sf-ui, built on Netflex TV's page engine. - InnerTube: web client for public pages, the TV client with the account's OAuth token for personal ones, visionOS (direct URLs) for streams, the TV client with yt-dlp's ejs solver (QuickJS) as fallback. - One version, no ads: ad breaks are never requested, ad renderers are skipped in feeds. SponsorBlock skips sponsored parts. - Sign-in with a QR code / youtube.com/activate (OAuth device flow). - Signed out: subscriptions and history on the TV; a home filled with this week's popular Hungarian videos when YouTube's is empty. - Playback: one-quality DASH manifest for GStreamer, H.264 up to 1080p or AV1 up to 4K, captions, quality switching, up next, resume. - Release builds for x86-64 and the Raspberry Pi (aarch64). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
50
AGENTS.md
Normal file
50
AGENTS.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Notes for AI agents working on YouTube for Fennec OS
|
||||
|
||||
Read first (Fennec SDK, https://gitea.bluefox.support/fennec/sdk):
|
||||
- `docs/store-app-guide.md`: what a Fennec OS store app must be (manifest, sandbox, remote, packaging, release).
|
||||
- `docs/sf-ui.md`: the UI kit. Liquid Glass model, components, focus, dev tools, pitfalls.
|
||||
|
||||
## Layout
|
||||
|
||||
```
|
||||
app.toml store manifest (id support.bluefox.youtube; permissions network, gpu, audio)
|
||||
src/main.rs window, glass layer (lists every exported [GlassRect]), images, controller
|
||||
src/app.rs Controller: screen stack, keys, QR sign-in overlay, toast, backdrop
|
||||
src/page.rs the line-based page engine (from Netflex TV): lines and chips -> layout, focus, scroll, lazy images
|
||||
src/screens/mod.rs sections, cards (v:/c:/p:/m: ids), Load<T>, Paged (feeds with continuations), opening a card
|
||||
src/screens/*.rs home, subs, library, search, settings, channel, playlist
|
||||
src/player.rs video id -> yt::stream -> MPD -> sf_ui::video::Player; captions, quality, SponsorBlock, up next
|
||||
src/yt/mod.rs InnerTube client: client profiles, browse/search/next/player, account
|
||||
src/yt/parse.rs the tree walker: any answer -> shelves of videos/channels/playlists (skips ads)
|
||||
src/yt/auth.rs OAuth device flow (youtube.com/activate), refresh, revoke
|
||||
src/yt/stream.rs player answer -> formats -> one-quality DASH manifest; TV client signatures
|
||||
src/yt/jsc.rs yt-dlp's ejs solver in QuickJS (n / sig challenges), player script cache
|
||||
src/yt/extras.rs SponsorBlock, channel RSS, captions (json3), mark watched
|
||||
src/config.rs settings.toml, account.toml, library.json (history, local subscriptions)
|
||||
ejs/ yt-dlp ejs 0.8.0 solver scripts (Unlicense), embedded with include_str!
|
||||
ui/app.slint root: screens, one FocusScope -> Rust `key`, glass exports
|
||||
ui/{page,player,link,overlays,types}.slint
|
||||
```
|
||||
|
||||
## Rules of this codebase
|
||||
|
||||
- **Rust owns state and focus.** Slint only draws. Every key goes to `Controller::key`, except while the search keyboard has the focus.
|
||||
- **Short borrows:** never hold `state.borrow_mut()` while calling `images.load*` or anything that may call back.
|
||||
- **Glass:** new glass elements need their `glass` listed in a root `out property <[GlassRect]>`, and that array added in `main.rs`.
|
||||
- **A new page** is a `Screen`: `spec` returns lines, `activate` gets (line id, card/chip id). Feeds use `Paged` (continuations).
|
||||
- **YouTube changes often.** Don't hard-code one layout: add renderers to `parse::walk`, keep tests with small JSON samples. Client versions follow yt-dlp's `_base.py`; the stream client order follows its `_DEFAULT_CLIENTS`.
|
||||
- **One quality per manifest:** GStreamer's adaptive DASH starts at 144p; `Playable::uri` writes only the chosen height.
|
||||
- **No ads:** never request ad endpoints, keep ad renderers in `parse::SKIP`.
|
||||
- **Texts are Hungarian** (the client asks YouTube with hl=hu, gl=HU, so YouTube's own texts are Hungarian too).
|
||||
|
||||
## Check your change
|
||||
|
||||
```sh
|
||||
cargo test
|
||||
cargo test live -- --ignored --nocapture # real YouTube: search, stream formats, channel, solver
|
||||
HOME=/tmp/ythome SF_UI_SIZE=1920x1080 SF_UI_KEYS="wait wait wait wait down enter" SF_UI_SNAPSHOT=/tmp/shot.png cargo run
|
||||
```
|
||||
|
||||
- **Playback** needs Linux (GStreamer). WSL with WSLg works (software decoding, Material look).
|
||||
- A written manifest can be tried alone: `gst-launch-1.0 playbin uri=file:///tmp/youtube-<id>.mpd`.
|
||||
- Too many requests in a row get HTTP 429 from YouTube for a while.
|
||||
Reference in New Issue
Block a user