0 youtube-api youtube-data-api youtube-livestreaming-api
我正在尝试使用 YouTube API 进行直播。但是,我没有得到任何结果。这是我所做的:
转到#Live YouTube 频道:
www youtube com channel / UC4R8DWoMoI7CAwX8_LjQHig
Run Code Online (Sandbox Code Playgroud)打开任何直播以获取广播 ID(例如,“CGt1Ac1gEZc”)。
尝试在 irb 中使用此广播 ID:
irb(main):038:0> list = youtube.list_live_broadcasts("id,snippet,contentDetails,status", id: "CGt1Ac1gEZc")
=> #<Google::Apis::YoutubeV3::ListLiveBroadcastsResponse:0x0000000546a960 @etag="\"oqbvhYxBE6fAbRk6m7aLlHf5s1I/P7sEkFelJCqPWY-5t7EUKYER_MQ\"", @items=[], @kind="youtube#liveBroadcastListResponse", @page_info=#<Google::Apis::YoutubeV3::PageInfo:0x000000054634d0 @results_per_page=5, @total_results=0>>
irb(main):039:0> list.items.inspect
=> "[]"
Run Code Online (Sandbox Code Playgroud)如您所见,@items数组为空。
打开https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/list尝试在那里获取数据,但仍然没有(见图):http : //i.imgur.com/6KTr1YS.png
仍然是空@items数组。尽管此广播 100% 在线,但我尝试按“所有”广播过滤,结果相同:未找到任何项目。
这是我的错还是 YouTube API 发生了什么问题?
该查询返回 0 个项目,因为liveBroadcasts/list端点只能用于广播您已通过身份验证的频道已创建。您不能使用list端点来检索有关其他任何人的广播的信息。
如果要检索有关另一个频道的广播的信息,则必须使用标准Search/list端点。这将仅返回来自特定频道的实时事件,而不会被验证为该频道/用户,如果您知道该频道的channelId:
part -> snippet
channelId -> [channelId of the channel/user with the live event]
eventType -> live
type -> video(设置eventType为时需要live)
HTTP GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={channelId}&eventType=live&type=video&key={YOUR_API_KEY}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4480 次 |
| 最近记录: |