2016-03-09 3 views
0

Я ищу, чтобы вернуть дату расписания для потока на YouTube.Возвратите предстоящий график видео YouTube API V3?

Пример запланированных потоков: enter image description here

YT Ссылка: https://www.youtube.com/channel/UCP7jMXSY2xbc3KCAE0MHQ-A

Это мой код, чтобы вытащить эти данные с использованием v3 YouTube API:

 $videos = $this->yt->searchAdvanced(array(
      'q' => '', 
      'part' => 'snippet', 
      'channelId' => $this->channel_id, 
      'eventType' => $event_type, // Upcoming 
      'type' => 'video', 
      'order' => 'date', 
      'maxResults' => $max, 
      'key' => YOUTUBE_API_KEY 
     )); 

Вот объект, возвращается из этого: enter image description here

Если я использую свою функцию для получения видеоинформации, это вся информация, которую я могу получить. Использование частей:

id, snippet, contentDetails, player, statistics, status 

: Где дата: по расписанию? :

stdClass Object 
(
    [kind] => youtube#video 
    [etag] => "q5k97EMVGxODeKcDgp8gnMu79wM/KAZsrzeX5ImiUQpLbwhPR7lo9mA" 
    [id] => qUAmTYHEyM8 
    [snippet] => stdClass Object 
     (
      [publishedAt] => 2016-03-03T06:48:50.000Z 
      [channelId] => UCP7jMXSY2xbc3KCAE0MHQ-A 
      [title] => Match 3 - Google DeepMind Challenge Match: Lee Sedol vs AlphaGo 
      [description] => Watch DeepMind's program AlphaGo take on the legendary Lee Sedol (9-dan pro), the top Go player of the past decade, in a $1M 5-game challenge match in Seoul. This is the livestream for Match 3 to be played on: 12th March 13:00 KST (local), 04:00 GMT; note for US viewers this is the day before on: 11th March 20:00 PT, 23:00 ET. 

In October 2015, AlphaGo became the first computer program ever to beat a professional Go player by winning 5-0 against the reigning 3-times European Champion Fan Hui (2-dan pro). That work was featured in a front cover article in the science journal Nature in January 2016. 

Match commentary by Michael Redmond (9-dan pro) and Chris Garlock. 
      [thumbnails] => stdClass Object 
       (
        [default] => stdClass Object 
         (
          [url] => https://i.ytimg.com/vi/qUAmTYHEyM8/default_live.jpg 
          [width] => 120 
          [height] => 90 
         ) 

        [medium] => stdClass Object 
         (
          [url] => https://i.ytimg.com/vi/qUAmTYHEyM8/mqdefault_live.jpg 
          [width] => 320 
          [height] => 180 
         ) 

        [high] => stdClass Object 
         (
          [url] => https://i.ytimg.com/vi/qUAmTYHEyM8/hqdefault_live.jpg 
          [width] => 480 
          [height] => 360 
         ) 

        [standard] => stdClass Object 
         (
          [url] => https://i.ytimg.com/vi/qUAmTYHEyM8/sddefault_live.jpg 
          [width] => 640 
          [height] => 480 
         ) 

        [maxres] => stdClass Object 
         (
          [url] => https://i.ytimg.com/vi/qUAmTYHEyM8/maxresdefault_live.jpg 
          [width] => 1280 
          [height] => 720 
         ) 

       ) 

      [channelTitle] => DeepMind 
      [categoryId] => 28 
      [liveBroadcastContent] => upcoming 
      [localized] => stdClass Object 
       (
        [title] => Match 3 - Google DeepMind Challenge Match: Lee Sedol vs AlphaGo 
        [description] => Watch DeepMind's program AlphaGo take on the legendary Lee Sedol (9-dan pro), the top Go player of the past decade, in a $1M 5-game challenge match in Seoul. This is the livestream for Match 3 to be played on: 12th March 13:00 KST (local), 04:00 GMT; note for US viewers this is the day before on: 11th March 20:00 PT, 23:00 ET. 

In October 2015, AlphaGo became the first computer program ever to beat a professional Go player by winning 5-0 against the reigning 3-times European Champion Fan Hui (2-dan pro). That work was featured in a front cover article in the science journal Nature in January 2016. 

Match commentary by Michael Redmond (9-dan pro) and Chris Garlock. 
       ) 

     ) 

    [contentDetails] => stdClass Object 
     (
      [duration] => PT0S 
      [dimension] => 2d 
      [definition] => sd 
      [caption] => false 
      [licensedContent] => 1 
     ) 

    [status] => stdClass Object 
     (
      [uploadStatus] => uploaded 
      [privacyStatus] => public 
      [license] => youtube 
      [embeddable] => 1 
      [publicStatsViewable] => 1 
     ) 

    [statistics] => stdClass Object 
     (
      [viewCount] => 41 
      [likeCount] => 1 
      [dislikeCount] => 0 
      [favoriteCount] => 0 
      [commentCount] => 0 
     ) 

    [player] => stdClass Object 
     (
      [embedHtml] => 
     ) 

) 

Обратите внимание, что даты опубликования я выделил это НЕ дата расписания.

Как вы можете видеть, нет запланированной даты. Нужно ли передавать больше данных в «часть»? Их API предполагает, что больше нет данных, которые можно отбросить.

https://developers.google.com/youtube/v3/docs/search/list#request

Благодаря

ответ

2

Хорошо, я работал его.

Просто введите liveStreamingDetails в параметр part.

Я пытался достичь этого через search.list. Вместо этого используйте videos.list с liveStreamingDetails, чтобы получить дату расписания, так как search.list не поддерживает liveStreamingDetails.

Cheers

Смежные вопросы