返回即将到来的 YouTube API V3 视频排期日期? [英] Return upcoming YouTube API V3 video schedule date?

查看:22
本文介绍了返回即将到来的 YouTube API V3 视频排期日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望返回 YouTube 中流的安排日期.

预定流的示例:

YT 链接:

如果我使用我的函数获取视频信息,这就是我可以获得的所有信息.这是使用零件:

id、snippet、contentDetails、player、statistics、status

:预定日期在哪里?:

stdClass 对象([种类] =>youtube#视频[etag] =>"q5k97EMVGxODeKcDgp8gnMu79wM/KAZsrzeX5ImiUQpLbwhPR7lo9mA"[id] =>QUAmTYHEyM8[片段] =>标准类对象([已发布] =>2016-03-03T06:48:50.000Z[频道ID] =>UCP7jMXSY2xbc3KCAE0MHQ-A[标题] =>第 3 场 - 谷歌 DeepMind 挑战赛:李世石 vs AlphaGo[说明] =>观看 DeepMind 的程序 AlphaGo 在首尔举行的一场价值 100 万美元的 5 场挑战赛中,与传奇的李世石(9 段职业选手)——过去十年的顶级围棋选手——的较量.这是第三场比赛的直播时间:3 月 12 日 13:00 KST(本地),04:00 GMT;美国观众请注意,这是前一天:3 月 11 日 20:00 PT,23:00 ET.2015 年 10 月,AlphaGo 以 5-0 战胜三届欧洲冠军范慧(2 段职业选手),成为有史以来第一个击败职业围棋选手的计算机程序.这项工作于 2016 年 1 月发表在科学杂志《自然》的封面文章中.Michael Redmond(9段职业选手)和Chris Garlock的比赛解说.[缩略图] =>标准类对象([默认] =>标准类对象([网址] =>https://i.ytimg.com/vi/qUAmTYHEyM8/default_live.jpg[宽度] =>120[高度] =>90)[中] =>标准类对象([网址] =>https://i.ytimg.com/vi/qUAmTYHEyM8/mqdefault_live.jpg[宽度] =>320[高度] =>180)[高] =>标准类对象([网址] =>https://i.ytimg.com/vi/qUAmTYHEyM8/hqdefault_live.jpg[宽度] =>480[高度] =>360)[标准] =>标准类对象([网址] =>https://i.ytimg.com/vi/qUAmTYHEyM8/sddefault_live.jpg[宽度] =>640[高度] =>480)[最大分辨率] =>标准类对象([网址] =>https://i.ytimg.com/vi/qUAmTYHEyM8/maxresdefault_live.jpg[宽度] =>1280[高度] =>720))[频道标题] =>深度思维[类别Id] =>28[liveBroadcastContent] =>即将到来[本地化] =>标准类对象([标题] =>第 3 场 - 谷歌 DeepMind 挑战赛:李世石 vs AlphaGo[说明] =>观看 DeepMind 的程序 AlphaGo 在首尔举行的一场价值 100 万美元的 5 场挑战赛中,与传奇的李世石(9 段职业选手)——过去十年的顶级围棋选手——的较量.这是第三场比赛的直播时间:3 月 12 日 13:00 KST(本地),04:00 GMT;美国观众请注意,这是前一天:3 月 11 日 20:00 PT,23:00 ET.2015 年 10 月,AlphaGo 以 5-0 战胜三届欧洲冠军范慧(二段职业选手),成为有史以来第一个击败职业围棋选手的计算机程序.这项工作于 2016 年 1 月发表在科学杂志《自然》的封面文章中.Michael Redmond(9段职业选手)和Chris Garlock的比赛解说.))[内容详情] =>标准类对象([持续时间] =>PT0S[尺寸] =>2d[定义] =>标准差[标题] =>错误的[许可内容] =>1)[状态] =>标准类对象([上传状态] =>上传[隐私状态] =>民众[许可证] =>YouTube[可嵌入] =>1[publicStatsViewable] =>1)[统计] =>标准类对象([查看次数] =>41[likeCount] =>1[dislikeCount] =>0[收藏夹] =>0[评论数] =>0)[玩家] =>标准类对象([embedHtml] =>))

请注意,我突出显示的发布日期不是计划日期.

如您所见,没有预定日期.我是否需要将更多数据传递给部分"?他们的 API 表明没有更多数据可以撤回了.

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

谢谢

解决方案

好的,我解决了.

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

我试图通过 search.list 实现这一目标.而是使用 videos.listliveStreamingDetails 来获取计划日期,因为 search.list 不支持 liveStreamingDetails.

干杯

I'm looking to return the schedule date for a stream in YouTube.

Example of scheduled streams:

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

This is my code to pull this data out using the 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
        ));

Here is the object that is returned from this:

If I use my function to get video info this is all the information I can get. This is using parts:

id, snippet, contentDetails, player, statistics, status

: Where is the scheduled date? :

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] => 
        )

)

Note that the published date I highlighted is NOT the schedule date.

As you can see there is no scheduled date. Do I need to pass more data to 'part'? Their API suggests there's no more data that can be pulled back too.

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

Thanks

解决方案

Okay I worked it out.

Simply add liveStreamingDetails to the part parameter.

I was trying to achieve this through search.list. Instead use the videos.list with liveStreamingDetails to get the schedule date as search.list doesn't support liveStreamingDetails.

Cheers

这篇关于返回即将到来的 YouTube API V3 视频排期日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆