Repository navigation
[xExtension-YouTube] Stop FreshRSS from appending the enclosures again - #565
Merged
Merged
Conversation
Since FreshRSS stores the enclosures as entry attributes, it renders them at display time: FreshRSS_Entry::content() appends the thumbnail and each enclosure whose URL is not found in the content. The extension builds its own content from $entry->content(), which already includes the rendered enclosures, and replaces them with the video player (and, when "Display the feeds content" is enabled, its own title, thumbnail and description). None of the original URLs are part of that new content, so FreshRSS then appended the whole enclosure again below the video: the thumbnail, a 💾 link to the old Flash URL and the description, shown twice in the second case. Add hidden references to the URLs of the thumbnail and of the enclosures at the end of the generated content, so FreshRSS knows they are already handled. This is the same approach ImageProxy uses with its data-xextension-imageproxy-original-src attributes. The entry attributes are left untouched, so the list thumbnail and the enclosures exposed through the APIs do not change. Bump the extension version to 1.4.1. Fixes FreshRSS#290
Alkarex
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FreshRSS_Entry::content()appends the thumbnail and each enclosure whose URL is not found in the content. The extension builds its content from$entry->content(), which already includes the rendered enclosures, and replaces them with the video player (plus its own title, thumbnail and description when Display the feeds content is enabled). None of the original URLs are in that new content, so FreshRSS appended the whole enclosure again below the videoFreshRSS_Entry::content()knows they are already handled. This is the approach suggested in the issue ([Bug] Enclosures whose URL has been changed by plugins are displayed twice FreshRSS#7240 (comment)) and the one ImageProxy already uses withdata-xextension-imageproxy-original-srcFixes #290
Validation
End-to-end with FreshRSS
edge(PHP 8.3): parse a feed withFreshRSS_SimplePieCustom+FreshRSS_Feed::loadEntries(), runembedYouTubeVideo(), then render$entry->content(true)likeindex/normal.phtml:media:groupwithmedia:content,media:thumbnail,media:description)main, Display the feeds content disabled: iframe, then<figure class="enclosure">with the thumbnail, a 💾 link tohttps://www.youtube.com/v/…?version=3and the descriptionmain, Display the feeds content enabled: the extension's iframe and description, then the same<figure>again (description shown twice)$entry->thumbnail()is unchanged/videos/watch/<uuid>link (amedia:thumbnailand two video enclosures): onmainthe thumbnail and two<video>players were appended below the iframe, with this change noneAlso
phpcsandphpstan(with../FreshRSS).