Also – for
$youtube->playlistItems->listPlaylistItems('snippet', $args);
the videoId doesn’t need to be parsed out of the image url like so:
$pattern = '/\/vi\/(.*)\//';
preg_match($pattern, $newResult['thumb_url'], $matches, PREG_OFFSET_CAPTURE, 3);
$newResult['id'] = $matches[1][0];
– you can simply access it under
$searchResult['snippet']['resourceId']['videoId'];