youtube - 返回即将推出的 YouTube API V3 视频安排日期?

标签 youtube youtube-api youtube-data-api

我想要返回 YouTube 中直播的安排日期。

预定流的示例: enter image description here

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

这是我使用 YouTube v3 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

谢谢

最佳答案

好的,我已经解决了。

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

我试图通过search.list来实现这一点。请改用 videos.listliveStreamingDetails 来获取安排日期,因为 search.list 不支持 liveStreamingDetails .

干杯

关于youtube - 返回即将推出的 YouTube API V3 视频安排日期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35889354/

相关文章:

jquery - 如何使用 Jquery 和 Youtube api V3 获取 Youtube 评论?

video - youtube:链接默认显示高清视频

amazon-s3 - 如何使用 AWS S3 作为视频源在 Youtube 上上传视频

ios - Google YouTube API v3 iOS 应用 key ,403 错误代码

javascript - 通过 API 提取 Nerd 的 youtube 统计信息

youtube - 在Json中获取YouTube趋势v3(国家/地区)明智信息-仅返回4个视频

javascript - 你能在视频完成时让 youtube 视频退出全屏吗

iphone - 当应用程序为 applicationDidEnterBackground 时,GData YouTube 在后台上传

android - 订阅 channel 发生变化时如何从 youtube 获取 Android 中的 GCM 通知

python - 如何在 Python 中使用 Youtube API 在 channel 中创建广播?