0

我正在使用标准/示例 Google API 代码来列出频道中的 YouTube 视频:

$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>";
}

但是,它返回的列表充满了我发起的大量 On Air Hangout 事件,但从未单击“开始广播”按钮,这会导致它们被保存/存档到我的 YouTube 帐户中。几乎就像,在开始广播之前取消“直播”环聊会创建这些幽灵播放列表项......我如何检测它们(并从显示的 API 调用返回的列表中过滤它们?)

4

0 回答 0