diff --git a/xExtension-YouTube/README.md b/xExtension-YouTube/README.md index e89c55f6..6da2f57a 100644 --- a/xExtension-YouTube/README.md +++ b/xExtension-YouTube/README.md @@ -23,6 +23,9 @@ With activated Youtube extension: ## Changelog +1.4.1: +- Fixed the original thumbnail, description and enclosures of the feed being appended below the video + 1.4.0: - Added an option to disable embedding videos, e.g. to only use the channel icons and URL conversion diff --git a/xExtension-YouTube/extension.php b/xExtension-YouTube/extension.php index 052528fe..95b71a76 100644 --- a/xExtension-YouTube/extension.php +++ b/xExtension-YouTube/extension.php @@ -480,6 +480,31 @@ private function hasEnclosureStructure(string $content): bool { || stripos($content, 'enclosure-description') !== false; } + /** + * Returns hidden references to the URLs of the thumbnail and enclosures of an entry. + * When displaying an entry, FreshRSS appends the thumbnail and enclosures whose URL is not found in the content, + * which would show them again after the video player that replaces them. + */ + private function getEnclosureReferences(FreshRSS_Entry $entry): string { + $urls = []; + $thumbnail = $entry->thumbnail(searchEnclosures: false); + if ($thumbnail !== null) { + $urls[] = $thumbnail['url']; + } + foreach ($entry->enclosures() as $enclosure) { + $urls[] = $enclosure['url']; + } + + $references = ''; + foreach (array_unique($urls) as $url) { + if ($url === '') { + continue; + } + $references .= '
'; + } + return $references; + } + /** * Returns an HTML