Exclude live events from YouTube data api search query

我只是一个虾纸丫 提交于 2019-12-01 18:38:51

问题


I'm using the google-api-php-client (https://github.com/google/google-api-php-client) to search and retrieve only videos from YouTube. I know you can set a query marker called type to video like this:

$searchquery = array(
      'q' => "flux",
      'maxResults' => 10,
      'type' => 'video',
      'videoDuration' => 'short',
      'videoEmbeddable' => 'true'
    );

However it seems to also return live events/livestreams in the search results. Is there a way to exclude live event videos? They have a marker called [liveBroadcastContent] => upcoming so I can do post-search but that's not ideal. Thanks in advance.

edit: on closer inspection, not all livestreams even seem to have the marker [liveBroadcastContent] set. I have found some that are set to none as with ordinary videos.

来源:https://stackoverflow.com/questions/32025288/exclude-live-events-from-youtube-data-api-search-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!