当通道启动时,是否可以从YouTube获取某种标志?
例如,当YouTube频道开始直播时,我需要能够获取该信息并使用它。有可能吗?
发布于 2017-09-01 02:09:00
可以使用live.,然后将参数设置为search.list
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCXswCcAMb5bvEUIDEzXFGYg&type=video&eventType=live&key=[API_KEY]示例代码片段:
// Sample php code for search.list
function searchListLiveEvents($service, $part, $params) {
$params = array_filter($params);
$response = $service->search->listSearch(
$part,
$params
);
print_r($response);
}
searchListLiveEvents($service,
'snippet',
array('eventType' => 'live', 'maxResults' => 25, 'q' => 'news', 'type' => 'video'));希望这能有所帮助。
https://stackoverflow.com/questions/45962036
复制相似问题