首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >返回即将到来的YouTube API V3视频调度日期?

返回即将到来的YouTube API V3视频调度日期?
EN

Stack Overflow用户
提问于 2016-03-09 10:45:53
回答 2查看 2.8K关注 0票数 6

我希望返回YouTube中的流的计划日期。

计划流示例:

YT链接:https://www.youtube.com/channel/UCP7jMXSY2xbc3KCAE0MHQ-A

这是我使用YouTube v3 API提取这些数据的代码:

代码语言:javascript
复制
        $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
        ));

下面是从这里返回的对象:

如果我使用我的功能来获取视频信息,这就是我能得到的所有信息。这是使用部件:

代码语言:javascript
复制
id, snippet, contentDetails, player, statistics, status

*预定日期在哪里?

代码语言:javascript
复制
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

谢谢

EN

回答 2

Stack Overflow用户

发布于 2016-03-09 14:16:39

好吧,我算出来了。

只需将liveStreamingDetails添加到part参数即可。

我正试图通过search.list来实现这一点。相反,使用videos.listliveStreamingDetails来获取日程日期,因为search.list不支持liveStreamingDetails

干杯

票数 13
EN

Stack Overflow用户

发布于 2020-08-01 07:13:59

YouTube Live的list文档有一个相关的示例:

list (by broadcast status) ...retrieve有关所有、活动、已完成或即将进行的直播的信息。注意,broadcastStatus参数也被设置为all,以确保响应中包含所有匹配的广播。获取KEY] HTTP/1.1授权:承载YOUR_ACCESS_TOKEN接受: application/json

启动时间可以在part=liveStreamingDetails中找到,它将包含ISO格式的scheduledStartTimeactiveLiveChatId

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35889354

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档