YouTube API - playlist returning invalid hangout videos
Using the standard/example code provided by Google for the YouTube API in
order to display the list of videos found on a channel, I am getting lots
of invalid and non-existent videos returned back. They appear to have been
created by On Air Hangout events (for which, the "Start Broadcast" button
was never pressed and instead the event was just cancelled).
$channelsResponse = $youtube->channels->listChannels("contentDetails", array(
"mine" => "true", ));
foreach ($channelsResponse["items"] as $channel) {
$uploadsListId = $channel["contentDetails"]["relatedPlaylists"]["uploads"];
$playlistItemsResponse =
$youtube->playlistItems->listPlaylistItems("snippet", array(
"playlistId" => $uploadsListId,
"maxResults" => 50
));
echo "<h3>Videos in list $uploadsListId</h3><ul>";
foreach ($playlistItemsResponse["items"] as $playlistItem) {
echo $playlistItem["snippet"]["title"] . " (" .
$playlistItem["snippet"]["resourceId"]["videoId"] . ")<br>";
echo "<img src=" .
$playlistItem["snippet"]["thumbnails"]["default"]["url"] . "><br>";
echo "<br><br>";
}
echo "</ul>";
}
The invalid videos being returned do NOT show up when actually going into
my YouTube account in the Video Manager. It's like they are ghost
listings. Of course, actually conducting an On Air Hangout will cause the
video to be archived in YouTube and show up on the list as normal. But it
appears there is a bug that's causing cancelled events to show up to...
with no way to filer for them, delete them, or prevent them from being
returned. Help!!!
No comments:
Post a Comment