Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YouTube Channels — FreshRSS extension

Follow YouTube channels in FreshRSS by pasting any link to them, and keep them updating even while YouTube’s feed server misbehaves. No proxy, no API key, no account.

YouTube publishes an Atom feed of the latest 15 uploads of every channel (https://www.youtube.com/feeds/videos.xml?channel_id=UC…), but the links you copy from YouTube are channel pages such as https://www.youtube.com/@NASA, which FreshRSS cannot subscribe to by itself. This extension turns any channel, video or playlist link into the right feed, and fetches YouTube feeds so that they keep working when the feed server fails.

Why

  • Channel links are not feeds. Only /channel/UC… links carry the ID that the feed needs. Today YouTube shares @handle links, and older channels have /c/… and /user/… ones.
  • YouTube’s feed server fails a lot. Since late 2025 it answers requests from servers with random 404 Not Found and 500 errors, at times more than half of them, in bursts that last hours (FreshRSS#8808). A retry usually succeeds, but FreshRSS makes one request per refresh, so many YouTube feeds sit in error at any time. Adding a channel by its link fails the same way, because FreshRSS’s feed discovery checks the feed once.

What it does

  • Add a feed with any YouTube link: https://www.youtube.com/@NASA, /channel/UC…, /c/…, /user/…, a custom URL like youtube.com/NASA, a video (watch?v=…, youtu.be/…, /shorts/…, /live/…), or a playlist (playlist?list=…). Tabs and tracking parameters don’t matter. The subscription becomes YouTube’s own feed of that channel or playlist. When the link doesn’t name the channel, the channel is read from YouTube’s page.
  • Retries. Whenever FreshRSS refreshes a YouTube feed, the extension downloads it itself and tries up to 6 times when the feed server answers 404, 500, 502 or 504. It doesn’t insist on other errors, such as 429 Too Many Requests.
  • Fallback to the channel page. When all attempts fail, the videos are read from the channel’s Videos tab instead, so new uploads still arrive. Only videos uploaded since the last refresh are taken from there: the page’s older videos are left out. The feed server gives better details (the exact upload time and the description), and the page lists 30 videos without Shorts, where the feed lists the latest 15.
  • Channel avatars become the feed icons instead of the YouTube logo (FreshRSS 1.29 and newer). They are read from the channel page once a month, at most 10 channels per refresh run.
  • Convert existing feeds (Settings → Extensions → YouTube Channels ⚙). This turns YouTube channel links that were added as they are, hand-made HTML + XPath scrapers of YouTube pages, and RSSHub (/youtube/channel/…, /youtube/user/…, /youtube/playlist/…), Invidious (/feed/channel/…) and Piped (/feed/unauthenticated/rss?channels=…) feeds into YouTube’s own feeds. Names, categories, articles and read states are kept. Subscriptions that are already YouTube feeds need nothing: the extension handles them as they are.

Entries look exactly like the ones FreshRSS gets from YouTube by itself (same IDs, thumbnails, descriptions), so other YouTube extensions, for example YouTube Video Feed for inline players, keep working.

Install

  1. Download this repository into a folder named xExtension-YouTubeChannels, either git clone https://github.com/shcheglovnd/FreshRSS-xExtension-YouTubeChannels.git xExtension-YouTubeChannels, or Code → Download ZIP and rename the extracted folder. FreshRSS accepts any folder name; xExtension-… is just the convention.
  2. Put that folder into the extensions/ directory of your FreshRSS. With the official Docker image that is the volume mounted at /var/www/FreshRSS/extensions.
  3. In FreshRSS: Settings → Extensions, then enable YouTube Channels. It is a per-user extension.

Requires FreshRSS 1.28 or newer (tested on 1.28.1 and 1.30.0).

Limitations

  • 15 videos per refresh, as in YouTube’s own feed. A channel that uploads more than that between two refreshes loses the overflow.
  • Fallback videos are approximate. The channel page gives upload times only as “13h ago” or “3 weeks ago”, so such videos get an approximate date and, as description, just their duration and view count. The page’s Videos tab has no Shorts and no live streams either. Playlist feeds have no fallback.
  • Tied to YouTube’s pages. The fallback, the avatars, and links that don’t name the channel depend on the data YouTube embeds in its pages (ytInitialData). If YouTube changes it, lib/YouTubeChannelsPage.php needs an update; feeds themselves keep working.
  • Disabling the extension keeps the feeds, because they are YouTube’s own feeds. They just go back to failing whenever the feed server does.

How it works

  • check_url_before_add recognises YouTube links (YouTubeChannelsUrl) and returns the feed URL, looking the channel up on the page when needed (YouTubeChannelsPage::channelId()).
  • simplepie_before_init runs whenever FreshRSS loads a feed. For a YouTube feed it downloads the feed with FreshRSS’s own HTTP client, so proxy settings, timeouts, caching and Retry-After handling are respected, and hands the result to SimplePie. If the feed server keeps failing, YouTubeChannelsPage reads the channel’s Videos tab and YouTubeChannelsFeed writes the videos as Atom in the feed server’s format. FreshRSS then processes it like any other feed.
  • Pages are requested with YouTube’s consent cookie (SOCS=CAI), so that visitors from the EU get the page and not the cookie-consent form, and as json from FreshRSS’s HTTP client, so that it doesn’t rewrite them as HTML.

Development

tests/urls.php checks which feed each kind of link becomes. tests/preview.php runs the page reader without FreshRSS:

php tests/urls.php
php tests/preview.php https://www.youtube.com/@NASA           # the link's feed, and the Videos tab
php tests/preview.php saved-videos-page.html
php tests/preview.php https://www.youtube.com/@NASA --atom    # the Atom built from the Videos tab

Test with php -d pcre.backtrack_limit=10000: FreshRSS lowers that limit at runtime, and the pages are over a megabyte.

License

MIT

About

FreshRSS extension: follow YouTube channels by pasting any link to them — no proxy, no API key. Retries YouTube’s flaky feed server and falls back to the channel page.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages