Below code, I got title and description but I want image as well as how to get the main image of video from JSON data.
$videoid = 'cMC_PtgKDJE';
$apikey = 'xyzxyzxyz'; //My API key
$json = file_get_contents('https://www.googleapis.com/youtube/v3/videos?id='.$videoid.'&key='.$apikey.'&part=snippet');
$ytdata = json_decode($json);
print_r($ytdata);
echo '<h1>Title: ' . $ytdata->items[0]->snippet->title . '</h1>';
echo 'Description: ' . $ytdata->items[0]->snippet->description;