YouTube Streaming API returns no results

2020-03-31 06:54发布

I'm using Google's YouTube API Explorer (alternate) to look up information on streaming broadcasts.

No matter what I put into the various "Filter" fields (id, broadcastStatus, mine), I always get back something like

{
    "kind": "youtube#liveBroadcastListResponse",
    "etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/1a_a-Wfcf01HR1raH5I2Na5kI1o\"",
    "pageInfo": {
        "totalResults": 0,
        "resultsPerPage": 5
    },
    "items": [
    ]
} // (The etag changes each time)

This seems ridiculous, considering that someone somewhere is demonstrably streaming.

It makes sense that mine=true doesn't return any results because I've never broadcasted anything, but broadcastStatus=all should give me something.

What is going wrong?

标签: youtube-api
1条回答
走好不送
2楼-- · 2020-03-31 07:41

I know this is an old question but I've encountered the same issue yesterday and it seems that I'm missing the broadcastType parameter.

Acceptable values are:

all – Return all broadcasts.
event – Return only scheduled event broadcasts.
persistent – Return only persistent broadcasts.

https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/list

So my final request looks like:

https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id&mine=true&broadcastType=all
查看更多
登录 后发表回答