Native YouTube browsing and playback in Emacs with ETAF
app
  • Emacs Lisp 71.5%
  • Python 15.9%
  • JavaScript 12%
  • Makefile 0.5%
Find a file
Kinneyzhang 457f12c0d1
Some checks failed
Repository structure / structure (push) Has been cancelled
fix(theme): frame the client from the mode cell it declares
The title-bar menu switched the session's palette, but a panel had no way
to reach it: the client declared no surface, so the panel's own switch only
repainted its chrome.  The client now declares its palette, mode cell and
亮/暗 labels to a framing host, and a watcher keeps the shared UI tokens on
the same mode as the Views' own colors.

Validation: make check (etaf-youtube, 34 tests, 5 skipped without a graphics
display).  A mounted host switched the mode through the declared surface and
the video page repainted with the light palette.
2026-10-27 20:46:34 +08:00
.githooks feat: add the native YouTube client session and interface 2026-10-13 22:52:37 +08:00
.github/workflows chore(scripts): sync shared workspace tooling 2026-10-19 13:00:02 +08:00
backends/youtube feat(youtube): sign out from Emacs 2026-10-19 16:49:28 +08:00
benchmarks test(youtube): measure navigation and card hover repaint 2026-10-14 22:26:40 +08:00
lisp fix(theme): frame the client from the mode cell it declares 2026-10-27 20:46:34 +08:00
scripts chore(scripts): sync shared workspace tooling 2026-10-22 13:16:13 +08:00
tests fix(theme): frame the client from the mode cell it declares 2026-10-27 20:46:34 +08:00
.editorconfig feat: add the native YouTube client session and interface 2026-10-13 22:52:37 +08:00
.gitignore feat: add the native YouTube client session and interface 2026-10-13 22:52:37 +08:00
CHANGELOG.md refactor(youtube): run the client as an ETAF application 2026-10-20 09:30:33 +08:00
etaf-youtube.el fix(theme): frame the client from the mode cell it declares 2026-10-27 20:46:34 +08:00
LICENSE feat: add the native YouTube client session and interface 2026-10-13 22:52:37 +08:00
Makefile feat(youtube): sign in from Emacs with the bundled backend 2026-10-19 15:54:07 +08:00
README.md fix(theme): frame the client from the mode cell it declares 2026-10-27 20:46:34 +08:00

ETAF YouTube

ETAF YouTube is a native YouTube client rendered as one ETAF text application. It browses the signed-in account's home, Shorts, subscriptions, history, playlists, watch later, liked videos and live pages, searches with filters, opens channels and playlists, reads a video with its comments and recommendations, and plays the video with sound inside the application's own canvas. Listings and playback media come from the shared youtube skill through its protocol 1 JSON interface; a controlled browser keeps the account session, so the application never stores credentials.

The application is the unit of state: M-x etaf-youtube-open mounts it in *YouTube*, the shell adapts to the window width, and etaf-youtube-close releases the session, its requests and its player.

Capabilities

  • Browsing: home, Shorts, subscriptions, history, playlists, watch later, liked videos and live, with the account's filter chips and channel tabs.
  • Search: one query with the all, videos, channels, playlists and live filters.
  • Video page: title, author, subscriber and view counts, published date, like/dislike, subscribe, save and a comment section with replies.
  • Playback: the ETAF native video Component decodes the resolved stream into the application canvas, with audition, seek, volume, mute, playback rate, quality selection, captions rendered under the canvas and theater mode. Playback state is polled once a second, so the transport clock and position follow the decoder, and leaving a video stores its position for the next opening.
  • Appearance: dark and light palettes independent of the Emacs theme, a fixed search/account bar, rounded filter buttons and SVG navigation. A floating panel's title-bar switch drives the session's mode cell, so the video page repaints with the panel. Video cards put titles ahead of channel and view metadata; durations sit on the thumbnail and Shorts use a separate portrait grid.
  • Layout: the shell adapts from wide windows down to a compact one. The sidebar collapses to an icon rail, landscape cards become a single column, the watch page stacks and its transport wraps. The top bar has a stable height during loading, scrolling and resizing; navigation and content scroll independently below it. A short window shortens the canvas so the transport stays visible. Below about 40 columns or 12 rows the structure is kept and the viewport clips.
  • Regions: the shell, sidebar, content and comment areas are named regions, so M-g selects one with a hint key and C-c s/C-c c/C-c m focus the sidebar, content and comments directly.
  • Local state: playback preferences and per-video resume positions in a SQLite store; account lists and comments stay in memory because the account remains their authority.

Requirements

  • Emacs 29.1 or newer with the ETAF, ETAF UI, Ebox, ECSS and ETAF DB checkouts beside this repository (or ../etaf and so on from a nested checkout).
  • ffmpeg and ffplay for video and sound.
  • Node.js for the backend bundled in backends/youtube/; it talks to the controlled Chrome page that keeps the account session. No external skill is needed: sign in from Emacs with M-x etaf-youtube-login, check with M-x etaf-youtube-account, and sign out with M-x etaf-youtube-logout.

Start

(add-to-list 'load-path "/path/to/etaf-youtube")
(require 'etaf-youtube)
(etaf-youtube-open)

Opening the application replaces the current window's buffer without splitting it. The application owns its chrome, so it does not add an Emacs mode line or borrow the editor header line for its multi-row top bar. ETAF measures and follows the usable window viewport automatically, including the space the editor reserves at the right edge. A newly loaded feed has no selected card; route selection in the sidebar is independent of card selection.

Application keys: SPC play/pause, f/b seek five seconds, [/] volume, m mute, s sidebar, t theater, d appearance, r refresh, u back, RET activate, / search, and C-c s/C-c c/C-c m to focus the sidebar, content and comment regions. M-g selects a region by hint key, ? lists the application keys and region hints, and a key never fires while the search field (or any other text input) is editing. Escape, Tab, the arrows and q keep their framework behavior.

Documentation

The authoritative public API inventory is the Commentary in etaf-youtube.el. The ETAF Reference Manual documents the framework Components this application builds on.

Development

make check   # structure, compile, public acceptance, API declarations
make test    # the public acceptance suite only

The public suite runs headless and offline: the skill transport, the thumbnail downloader and the store are injected, and the fixtures contain only synthetic, public-shaped data.