diff --git a/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/YouTubeHelper.php b/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/YouTubeHelper.php index 89c8163..8aaa6ff 100644 --- a/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/YouTubeHelper.php +++ b/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/YouTubeHelper.php @@ -48,12 +48,16 @@ class YouTubeHelper extends AbstractOEmbedHelper $temporaryFileName = $this->getTempFolderPath() . 'youtube_' . md5($videoId) . '.jpg'; if (!file_exists($temporaryFileName)) { - $previewImage = GeneralUtility::getUrl( - sprintf('https://img.youtube.com/vi/%s/0.jpg', $videoId) - ); - if ($previewImage !== false) { - file_put_contents($temporaryFileName, $previewImage); - GeneralUtility::fixPermissions($temporaryFileName); + $tryNames = ['maxresdefault.jpg', '0.jpg']; + foreach($tryNames as $tryName) { + $previewImage = GeneralUtility::getUrl( + sprintf('https://img.youtube.com/vi/%s/%s', $videoId, $tryName) + ); + if ($previewImage !== false) { + file_put_contents($temporaryFileName, $previewImage); + GeneralUtility::fixPermissions($temporaryFileName); + break; + } } }