Skip to content

[xExtension-YouTube] Convert playlist URLs to their feed URL - #595

Merged
Alkarex merged 1 commit into
FreshRSS:mainfrom
NopeCharon:youtube-playlist-urls
Dec 5, 2026
Merged

Alkarex merged 1 commit into
FreshRSS:mainfrom
NopeCharon:youtube-playlist-urls

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

Summary

YouTube channel pages advertise their feed (<link rel="alternate" type="application/rss+xml">), so FreshRSS finds it when a channel or @handle URL is pasted, but playlist pages do not. Subscribing to https://www.youtube.com/playlist?list=…, e.g. with the bookmarklet, fails with A feed could not be found (FreshRSS/FreshRSS#6389, where it was suggested that this gap is better solved by an extension), so users have to build the feed URL themselves.

  • the check_url_before_add hook of the extension, which already converts /channel/ and /user/ URLs, now converts playlist URLs to https://www.youtube.com/feeds/videos.xml?playlist_id=…
    • from www.youtube.com, youtube.com (e.g. share links) and m.youtube.com. The channel and user conversions are left as they are: on those hosts, these pages redirect to www.youtube.com and advertise their feed anyway
    • the list parameter may be anywhere in the query string; other parameters (e.g. si of share links) and fragments are ignored
    • FreshRSS passes the URL HTML-encoded to the hook (&amp; between the query parameters, from the web interface as well as from the Google Reader API), so the URL is decoded before being matched
    • the playlist ID is restricted to [0-9a-zA-Z_-]; any other URL, including video URLs with a list parameter, is returned unchanged
  • since the hook also runs for the subscription preview (Call check_url_before_add hook when previewing a feed FreshRSS#9343), this works with the bookmarklet as well
  • add tests/YouTubeTest.php, a dependency-free regression test of the URL conversion on the model of tests/ImageProxyTest.php, run by a new test-youtube Composer script (also part of composer test) and by the CI workflow
  • README feature list and changelog, version 1.5.0

Playlist feeds have no link to a website, so the automatic channel icons do not apply to them, as for the playlist feeds that are added manually today.

Note: #581 also bumps the YouTube extension to 1.5.0, so whichever is merged second will need a small rebase of metadata.json and of the changelog, which I will take care of.

Validation

  • End-to-end with FreshRSS edge (PHP 8.4, SQLite) and the extension enabled:
    • the subscription preview (?c=feed&a=add&url_rss=…, as opened by the bookmarklet) of https://youtube.com/playlist?app=desktop&list=PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb shows the playlist Top Trending Videos of the Week, with https://www.youtube.com/feeds/videos.xml?playlist_id=PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb as feed URL
    • submitting https://m.youtube.com/playlist?si=a1B2c3&list=PLbpi6ZahtOH6Blw3RGYpWkSByi_T7Rygb adds that feed; after a refresh, its 15 entries are displayed with the embedded player, without any PHP warning
    • without the conversion (as on main), the subscription fails with A feed could not be found at https://youtube.com/playlist?…; the status code is 200 and content-type is text/html; charset=utf-8
  • tests/YouTubeTest.php (21 assertions) passes, and fails without the change of extension.php
  • php-lint, phtml-lint, test-image-proxy, phpcs, phpstan (with ../FreshRSS), markdownlint, eslint, stylelint and typos

YouTube channel pages advertise their feed with a <link rel="alternate">,
so FreshRSS discovers it when a channel or @handle URL is pasted, but
playlist pages do not. Subscribing to a playlist page, e.g. with the
subscription bookmarklet, therefore failed with "A feed could not be
found" (FreshRSS/FreshRSS#6389), and users had to build the feed URL
themselves.

The check_url_before_add hook of the extension now also converts
playlist URLs, from www.youtube.com, youtube.com (share links) and
m.youtube.com, to https://www.youtube.com/feeds/videos.xml?playlist_id=…
The `list` parameter may be anywhere in the query, and other parameters
(such as `si` from share links) and fragments are ignored.
FreshRSS passes the URL HTML-encoded to the hook (`&amp;` between the
query parameters), so the URL is decoded before being matched.
The playlist ID is restricted to the characters used by YouTube; any
other URL is returned unchanged.

Add tests/YouTubeTest.php, a dependency-free regression test of the URL
conversion on the model of tests/ImageProxyTest.php, run by the new
`test-youtube` Composer script, `composer test` and the CI workflow.

Document playlist URLs in the README, add a changelog entry and bump
the version to 1.5.0.
@Alkarex
Alkarex merged commit ab0196d into FreshRSS:main Dec 5, 2026
1 check passed
@Alkarex Alkarex added the xExtension-YouTube xExtension-YouTube label Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

xExtension-YouTube xExtension-YouTube

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants