Introducing a new way to review your PRs.

Read the announcement

iv-org / invidious

Invidious is an alternative front-end to YouTube

View on GitHub

19 documents · Updated Oct 12, 2026

docs / channel-content-and-subscriptions

Channel content and subscriptions

Channel pages turn YouTube channel data into a browsable profile. They combine channel identity, published content, playlists, community posts, related channels, and user subscription state. The same channel data also supports subscription feeds, notifications, RSS feeds, and API clients.

Channel identity and metadata

Channel metadata

The channel identity is keyed by a YouTube channel ID, called a ucid in this area. A channel lookup supplies the name, profile image, banner, description, verification state, subscriber count, view count, safety limits, and the tabs that the channel makes available. This shared profile data lets browser pages and API responses present the same channel even when a channel has moved or has a restricted view.

The channel lookup can report three different outcomes that shape the user experience:

  • A valid profile produces the channel page or API response.
  • A moved channel redirects to its current channel ID.
  • A missing or unavailable channel produces a not-found or error response.

References: src/…/about.cr• L2-22 src/…/about.cr• L22-41 src/…/channels.cr• L422-447

Channel presentation

The browser channel page presents the profile header before the selected content tab. The header connects the channel to its YouTube page, its channel RSS feed, the subscription control, and the available tabs. Content cards then provide the common path from a channel item to a watch page or another channel.

The header also reflects the signed-in user. A subscribed user sees an unsubscribe action. A visitor sees a link to sign in before subscribing. This keeps public channel browsing separate from account changes.

References: src/…/channel_info.ecr• L1-63 src/…/subscribe_widget.ecr• L1-35 src/…/channel.ecr• L30-59

Channel content

Channel tabs give each kind of channel content a consistent browse experience. A tab request first establishes the channel profile, then retrieves the selected content with an optional sort order and continuation cursor.

This diagram shows how one channel request becomes either an HTML page or an API result.

flowchart LR
    A[Channel request] --> B[Channel profile]
    B --> C{Selected content}
    C --> D[Videos, shorts, or streams]
    C --> E[Playlists and collections]
    C --> F[Community posts]
    C --> G[Related channels]
    D --> H[Cards or JSON]
    E --> H
    F --> H
    G --> H

Videos and live content

The main content views cover regular videos, Shorts, and livestreams. Each view supports a small set of meaningful sort choices and returns a continuation when more items are available. The browser uses that continuation for page navigation. The API returns it to the caller so a client can request the next page.

Restricted channels can expose only the content that YouTube makes available for that channel. The visible tab list from the channel profile controls whether a requested tab is valid.

References: src/…/videos.cr• L11-51 src/…/videos.cr• L58-92 src/…/channels.cr• L14-64 src/…/channels.cr• L143-187

Playlists and channel collections

Channel collection tabs present playlists as browseable items rather than as individual videos. The channel can expose general playlists plus specialized collections such as podcasts, releases, and courses. These collections use the same continuation pattern as video tabs and lead to playlist pages when selected.

Auto-generated channels follow a different content shape. Their collection view serves as the channel content view, while ordinary channels keep playlists as a separate tab.

References: src/…/playlists.cr• L1-54 src/…/channels.cr• L136-218 src/…/channels.cr• L280-397 src/…/item.ecr• L57-98

The channels tab shows channels that YouTube associates with the current channel. It is a browse relationship rather than a subscription relationship. Results can continue across pages and use the same channel-card presentation as other channel discovery surfaces.

References: src/…/about.cr• L209-220 src/…/channels.cr• L302-320 src/…/channels.cr• L477-506 src/…/item.ecr• L9-32

Community content

Community posts

The community tab presents posts from a channel beside the channel profile. A post can contain text, a video, a playlist, an image, a poll, a quiz, or several images. The response keeps the channel and post identity with the content so clients can link back to the author.

The browser can render the post list or one post. A post can also expose a continuation for more posts and a separate continuation for replies. Detailed comment behavior belongs to Comments and community content; this page covers how channel posts enter the channel experience.

References: src/…/community.cr• L4-25 src/…/community.cr• L36-57 src/…/community.cr• L59-86 src/…/channels.cr• L220-300

Community presentation

Community pages reuse the channel header so users can move between posts and the channel's other content. They support a thin mode for lower-detail display and expose post data to the browser for progressive comment and reply actions.

References: src/…/community.ecr• L1-45 src/…/channels.cr• L399-475

Subscriptions and feeds

Subscription state

Subscriptions are a user-owned set of channel IDs. The subscription control changes that set only for a signed-in user and checks a request token before it writes. A subscribe action also verifies that the target channel is known. An unsigned visitor is sent to login for the browser flow.

The subscription manager turns this set into a sorted list of channels. It also marks channels that are no longer available so a user can remove stale entries without losing the rest of the list.

References: src/…/subscriptions.cr• L2-55 src/…/subscriptions.cr• L58-121 src/…/subscription_manager.ecr• L1-52 src/…/authenticated.cr• L152-192

Subscription feed

The subscription feed combines recent channel videos with notification items. User preferences can limit the result to the latest item per channel, hide watched items, change the sort order, or show notifications only. The browser presents the result as a paged card list. The authenticated API exposes the same two groups as JSON.

Opening the browser feed clears the user's pending notification state when notifications are enabled. This makes the feed both a content view and the point at which the application records that the user has seen current updates.

References: src/…/users.cr• L25-105 src/…/feeds.cr• L64-110 src/…/subscriptions.ecr• L1-74 src/…/authenticated.cr• L116-150

Feed and RSS access

Each public channel has an Atom feed for its recent videos. A signed-in user can also use a private Atom feed for the subscription feed. The subscription manager can export subscriptions as Invidious JSON or OPML, with an option that points entries at YouTube's feed URLs for external feed readers.

These feeds provide access outside the main browser page. Their links still resolve back to Invidious channel and watch URLs, so the same content remains connected across the web interface and feed clients.

References: src/…/feeds.cr• L144-225 src/…/feeds.cr• L227-269 src/…/subscriptions.cr• L79-117 src/…/channel_info.ecr• L22-31

Browser and API interfaces

Browser channel routes

Browser routes cover channel tabs, individual posts, subscription actions, subscription management, and feed pages. Unsupported future channel tabs fall back to the channel home page. The browser path is designed for navigation, pagination, localized text, and account-aware controls.

References: src/…/routing.cr• L80-109 src/…/routing.cr• L116-138

API channel routes

The API offers channel metadata with an initial video set. Separate endpoints expose latest videos, videos, Shorts, streams, playlists, podcasts, releases, courses, related channels, community posts, post comments, and channel-scoped search. Responses keep continuation values and machine-readable channel and video fields so clients can build their own channel views.

The API also preserves a stable transition for older community comment paths. Those paths redirect to the channel community endpoint, while a post request can resolve its channel from the post ID when the caller does not provide one. The API and browser routes share the same channel and content retrieval layer. They differ mainly in presentation: browser routes render HTML while API routes return JSON.

References: src/…/routing.cr• L255-280 src/…/channels.cr• L17-140 src/…/channels.cr• L142-397 src/…/channels.cr• L399-475 src/…/channels.cr• L477-545

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the channel tab names aligned across channel metadata, browser routes, API routes, and tab links. A mismatch can turn a valid YouTube tab into a redirect or an unreachable API path.
  • Preserve continuation handling across the retrieval and presentation layers. A changed cursor shape can break both browser pagination and API clients.
  • Keep subscription IDs consistent with channel IDs used by channel lookup, local channel records, private feeds, and exported OPML.
  • When changing channel video refresh or notification records, check both the subscription feed and the private RSS feed. They consume the same update stream.
  • Keep browser subscription writes protected by the request-token contract. API subscription writes use the authenticated API contract instead.
  • Keep legacy community comment redirects aligned with the current community and post-comment API paths. Older clients depend on the redirect target and its query parameters.

Important failure modes

TriggerConsequenceGuard
YouTube returns a moved channel IDThe requested channel path is no longer the canonical pathRedirect the browser or return the API redirect with the replacement ID
A channel does not expose a requested tabThe tab request cannot produce valid contentCheck the channel's available tabs and return to the channel home
A continuation is missing or invalidLater pages can be empty or fail to parseTreat the continuation as opaque and return the next value supplied by the content source
An unsigned user opens a private subscription pageNo user feed or subscription state is availableRedirect to the referer or login path instead of reading private data
A subscription action has an invalid request tokenA user could change subscription state from an untrusted requestReject the action before changing the stored subscription set
The channel or playlist feed source returns not foundThe page or feed cannot identify current contentReturn the matching not-found response and keep stale subscriptions removable
An old community comment path is usedA client can miss the current community response shapeReturn the permanent redirect to the channel community endpoint

Key files

FileWhy to read it
src/invidious/channels/about.crDefines the shared channel profile and related-channel view
src/invidious/channels/videos.crShows the common retrieval model for channel video tabs and pagination
src/invidious/channels/playlists.crShows channel playlist and collection retrieval
src/invidious/channels/community.crDefines channel post retrieval and the community content shape
src/invidious/routes/channels.crConnects browser channel requests to profile, content, and community views
src/invidious/routes/api/v1/channels.crConnects channel data to machine-readable API responses and keeps community route transitions stable
src/invidious/users.crDefines how stored channel updates become a personalized subscription feed
src/invidious/routes/feeds.crConnects subscription, channel RSS, private RSS, and feed pages
src/invidious/routes/subscriptions.crDefines browser subscription changes, management, and export
src/invidious/views/components/channel_info.ecrShows the shared channel header and navigation surface
src/invidious/views/feeds/subscriptions.ecrShows how notifications and subscription videos are presented

See also: YouTube backend integration, Video watch and playback, Web and API route families, and API v1 response serialization.