Solid I
Solid I

Reputation: 690

YouTube API PHP - Trouble retrieving full video description

I've been playing around with the google/google-api-php-client. I've noticed that it says "build-failing", but some parts are working as expected, so I've been pressing on with it.

So I have built a search field that queries the YouTube API for videos containing a search string and prints the results. You'll see that I've also hooked up the YouTube Player iFrame API to play the video if it is clicked.YouTube API Search Results

Now these results do contain snippet data (title, description, channelId, etc...), but the item description's are limited to 160 characters and appended with an ellipsis .

print of search/list response

So now in an attempt to get a full description, I am sending another call to the YouTube API. I am calling $youtube->videos->listVideos('snippet',array('id' => '7dR02ebri9c')). The call is successful, but does not contain any snippet data.

I've logged the response to the console so you can see it here: console log of videos/listVideos response

And printed it here incase the above image does not show. {"etag":"\"43qFkeEQBKio26KDSq1ZQMzjhSo/3nlK0uyD_p1CFvvGkbiQcGORv5w\"","eventId":null,"kind":"youtube#videoListResponse","nextPageToken":null,"prevPageToken":null,"visitorId":null}

If I run the same request via the YouTube API Explorer, I receive a response complete with snippet data and a full description.

YouTube API Explorer Response

So I ask, is the problem the google/google-api-php-client I am using, the YouTube API itself, or perhaps something else?

Edit: I've found and thought about using madcoda/php-youtube-api instead, and will do-so if all else fails.

Upvotes: 0

Views: 840

Answers (1)

Solid I
Solid I

Reputation: 690

I've discovered that google/google-api-php-client was the problem here.

I've had success using madcoda/php-youtube-api instead.

Upvotes: 1

Related Questions