Has anyone had any issue retrieving thumbnails from the V3 YouTube API?
I do some rather simple calls and expect a single video back with it’s snippet info (which contains thumbs). But I don’t have that field returned.
Call the service:
$response = $service->videos->listVideos('id,snippet,contentDetails', array(
"id" => 'someid'
));
Pack things into an array to toss back to Javascript in JSON
foreach($response->items as $video)
{
$item = array();
$item['id'] = $video['id'];
$item['snippet'] = $video['snippet'];
$item['contentDetails'] = $video['contentDetails'];
$return_msg['items'][$item['id']] = $item;
}
I then take a gander at the returned object through the console in javascript, and see that there are no thumbs.
Also, one of the reasons I put everything into an ‘items’ array is because the $response object doesn’t populate the JSON response with anything more than the following fields:
etag
eventId
kind
nextPageToken
prevPageToken
visitorId
I have to explicitly loop through the items, rather than have a section called ‘items’ in the response object.