Dapatkan YouTube Thumbnail PHP

function youtubeThumbnail ($youtubeID, $size = 'default'): ?string
{
  $final_size = match ($size) {
    'low' => 'sddefault',
    'medium' => 'mqdefault',
    'high' => 'hqdefault',
    default => 'maxresdefult'
    };
  return "https://img.youtube.com/vi/". $youtubeID. "/". $final_size .".jpg";
}
KingUche