Skip to content

feat(fetcher/youtube): add youtube_channel - #220

Merged
unhappychoice merged 1 commit into
mainfrom
feat/fetcher-youtube-channel
May 12, 2026
Merged

unhappychoice merged 1 commit into
mainfrom
feat/fetcher-youtube-channel

Conversation

@unhappychoice

@unhappychoice unhappychoice commented May 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • New `youtube_channel` fetcher: recent uploads from one or more public YouTube channels, merged newest-first. No API key, no OAuth.
  • `Safety::Safe` — host hardcoded to `www.youtube.com`; each `channel_id` is regex-validated to `^UC[A-Za-z0-9_-]{22}$` before it touches the URL.
  • Multi-channel = parallel fetch + merge by `published` desc. Per-channel failures fall through silently when at least one channel succeeds; only all-fail surfaces an error so a YouTube outage is visible (the endpoint is intermittently broken in 2026 — see glanceapp/glance#910; uptime sits around 95% over the last 3 weeks).
  • Adopts the glanceapp/glance trick: `include_shorts = false` (default) rewrites `UC...` → `UULF...` and queries `?playlist_id=UULF...`, the channel's auto-generated long-form-uploads playlist, which excludes Shorts. `include_shorts = true` falls back to the raw `?channel_id=` feed.
  • Eight shapes (`linked_text_block` default + `text_block` / `text` / `markdown_text_block` / `image_linked_list` / `entries` / `image` / `timeline`) via five new helpers added to the shared `feed::` pipeline. `rss` and the `news_` family widen their `SHAPES` lists in lockstep, so all 93 news sources gain the same eight shapes too.

Ticks the `youtube_channel` and `youtube_channels` boxes on #67 — both collapse into one fetcher since `channel_ids: Vec` covers single- and multi-channel cases.

Catalog surface

Kind Safety Shapes
cached Safe `linked_text_block`, `text_block`, `text`, `markdown_text_block`, `image_linked_list`, `entries`, `image`, `timeline`

Options

Option Type Required Default Description
`channel_ids` array of strings (UC… channel IDs) yes — One or more YouTube channel IDs. Each must match `UC` + 22 chars from `[A-Za-z0-9_-]`.
`count` integer (1..=20) no 5 Number of merged uploads to display, sorted newest first across all channels.
`include_shorts` boolean no false When `false`, uploads come from the `UULF` long-form-uploads playlist (excludes Shorts). `true` reads the channel feed directly and includes Shorts.

Compatible renderers

Shape Renderers
`linked_text_block` `list_links`
`text_block` `list_plain` + the `animated_*` wrappers
`text` `text_plain`, `text_ascii`, animation wrappers
`markdown_text_block` `text_markdown`
`image_linked_list` `list_cards`
`entries` `grid_table` + animation wrappers
`image` `media_image` + animation wrappers
`timeline` `list_timeline` + animation wrappers

Test plan

  • `cargo fmt --all -- --check`
  • `cargo clippy --all-targets -- -D warnings`
  • `cargo test` (2188 passing, 0 failing, 1 `#[ignore]` live smoke test for the YouTube endpoint)
  • Catalog surface verified: `cargo run --bin splashboard -- catalog fetcher youtube_channel` lists all 8 shapes + 3 options + every compatible renderer
  • `cargo xtask` regenerates the reference doc cleanly
  • End-to-end smoke test in a real terminal — endpoint is intermittently 404-ing today; the fetcher surfaces `youtube_channel 404 Not Found` on those windows and renders cached / live entries when the endpoint is up

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

Summary by CodeRabbit

  • New Features
    • YouTube channel support: fetch public YouTube Atom feeds with configurable channel options including Shorts inclusion.
    • Multiple display formats: expanded feed rendering to support text, entries, timeline, and image layouts across news and RSS feeds.
    • Image caching: automated thumbnail retrieval and caching for feed entries.

Review Change Stack

Public YouTube channel uploads via the per-channel Atom feed. No API
key, no OAuth. `Safety::Safe` — the host is hardcoded and each
`channel_id` is regex-validated to `^UC[A-Za-z0-9_-]{22}$` before it
reaches the URL, so config cannot inject path or query bytes that
escape youtube.com.

Multi-channel = parallel fetch via `tokio::JoinSet` + merge by
`published` desc. Per-channel failures fall through silently as long as
at least one channel succeeds; only all-fail surfaces an error, so a
misspelled ID or a YouTube outage is visible rather than masked by the
empty-body placeholder.

Adopts the glanceapp/glance pattern: `include_shorts = false`
(default) rewrites `UC...` → `UULF...` and queries
`?playlist_id=UULF...`, the channel's auto-generated long-form-uploads
playlist, which excludes Shorts. `include_shorts = true` falls back to
the raw `?channel_id=` feed.

The YouTube RSS endpoint is intermittently unreliable in 2026
(glanceapp/glance#910): ~95% uptime over the last 3 weeks per public
UptimeRobot data, with occasional bad days. The cached-fetcher model
absorbs most of that — splash opens hit the prior cache when the
background refresh fails.

Eight shapes via the shared `feed::*` pipeline, which gains five new
helpers (`Text`, `MarkdownTextBlock`, `Entries`, `Image`, `Timeline`).
`rss` and the `news_*` family widen their `SHAPES` lists in lockstep,
so all 93 news sources now expose the same eight shapes too.

Ticks the `youtube_channel` and `youtube_channels` boxes on #67 — the
two collapse into one fetcher since `channel_ids: Vec<String>` covers
both single- and multi-channel cases.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@codecov

codecov Bot commented May 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.65953% with 109 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.28%. Comparing base (8a6c68f) to head (df3f5cd).

Files with missing lines Patch % Lines
src/fetcher/feed.rs 0.00% 57 Missing ⚠️
src/fetcher/youtube.rs 85.71% 52 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #220      +/-   ##
==========================================
- Coverage   95.46%   95.28%   -0.19%     
==========================================
  Files         159      160       +1     
  Lines       47253    47718     +465     
==========================================
+ Hits        45111    45467     +356     
- Misses       2142     2251     +109     
Files with missing lines Coverage Δ
src/fetcher/mod.rs 99.10% <100.00%> (+<0.01%) ⬆️
src/fetcher/news/mod.rs 82.16% <100.00%> (+1.48%) ⬆️
src/fetcher/rss.rs 91.44% <100.00%> (+0.34%) ⬆️
src/fetcher/youtube.rs 85.71% <85.71%> (ø)
src/fetcher/feed.rs 68.39% <0.00%> (-22.41%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ba638a3-5692-4d68-b677-2bbff81e7ff2

📥 Commits

Reviewing files that changed from the base of the PR and between 8a6c68f and df3f5cd.

📒 Files selected for processing (5)
  • src/fetcher/feed.rs
  • src/fetcher/mod.rs
  • src/fetcher/news/mod.rs
  • src/fetcher/rss.rs
  • src/fetcher/youtube.rs

📝 Walkthrough

Walkthrough

This PR introduces a YouTube channel fetcher and expands the feed rendering pipeline to support multiple output shapes. The shared feed infrastructure now renders entries as Text, Entries, Timeline, or Image payloads; a new YouTube fetcher fetches and merges multi-channel Atom feeds with validation and failure tolerance; and existing news/RSS fetchers are extended to declare and produce these new shapes.

Changes

YouTube fetcher and multi-shape feed rendering

Layer / File(s) Summary
Shared feed rendering infrastructure
src/fetcher/feed.rs
Expands render_body dispatch to handle Shape::Text, Shape::TextBlock, Shape::MarkdownTextBlock, Shape::Entries, and Shape::Timeline, using per-entry helpers for formatting. Adds async render_image_body to fetch and cache entry thumbnails, plus markdown_line (markdown-formatted list items with optional dates and links) and link_host (host extraction from entry URLs).
YouTube channel fetcher
src/fetcher/youtube.rs
New fetcher supporting concurrent, multi-channel YouTube Atom feed ingestion. Validates channel IDs via regex, constructs feed URLs using either default uploads playlist (excluding Shorts) or include_shorts=true mode, fetches and merges entries in parallel with per-channel failure tolerance, sorts newest-first, and renders via delegated feed::render_* dispatch. Includes comprehensive unit and integration tests covering options, validation, URL construction, feed merging, and cache key stability.
YouTube module integration
src/fetcher/mod.rs
Exposes the new youtube module and registers YoutubeChannelFetcher in the built-in fetcher registry.
Extend news and RSS fetchers
src/fetcher/news/mod.rs, src/fetcher/rss.rs
Both fetchers now declare support for the new shapes (Text, MarkdownTextBlock, Entries, Image, Timeline), provide sample bodies for the newly supported shapes, dispatch Shape::Image rendering via feed::render_image_body, and update shape-coverage tests to assert sample bodies for the new variants.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • unhappychoice/splashboard#218: Modifies the same feed rendering pipeline and updates news/RSS fetchers to use shared feed utilities, extending the rendering paths in parallel.
  • unhappychoice/splashboard#114: Also adds a new fetcher module under src/fetcher and wires it into Registry::with_builtins() using the same registration pattern.

Poem

🐰 A YouTube feed now hops through splashboard's door,
With shapes so many—text, timeline, and more!
Entries merge and sort, thumbnails cached with care,
Validation guards the channel IDs fair.
From one feed flow, each shape gets its share! 🎬

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(fetcher/youtube): add youtube_channel' clearly and concisely summarizes the main change: adding a new YouTube channel fetcher. It follows conventional commit format and directly matches the PR's primary objective.
Docstring Coverage ✅ Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/fetcher-youtube-channel

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@unhappychoice
unhappychoice merged commit 0484cae into main May 12, 2026
7 checks passed
@unhappychoice
unhappychoice deleted the feat/fetcher-youtube-channel branch May 12, 2026 16:04
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