Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End YouTube Api V3 thumbnails

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #168962
    fooman
    Participant

    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.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.