YouTube Data API no longer returns active live streams from search.list

强颜欢笑 提交于 2019-11-29 09:27:36

问题


I wrote an application that uses YouTube Data API V3's search.list, which was able to pull active live streams for a specified channel (working since 2018) using the following:

https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCSJ4gkVC6NrvII8umztf0Ow&type=video&eventType=live&key={MYAPIKEY}

The above no longer returns any results for me as of September 12, 2019.

Broadening the search to all videos for a specified channel also no longer shows the active live stream:

https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCSJ4gkVC6NrvII8umztf0Ow&order=date&key={MYAPIKEY}

However, searching the ID of the active live stream itself works to return information about the video, which leads me to believe there may still be a way to accomplish this:

https://www.googleapis.com/youtube/v3/videos?part=snippet&id=hHW1oY26kxQ&key=

I am looking for a new solution that would be able to query a channel to see if they have an active live stream running, and grab the properties for that live stream.


回答1:


There is definitely something going on with the YouTube Data API. If you give it a try on the on the Deverloper Console for Search: list it won't work if you are providing channelId. However, if you provide channelId it will always return 0 results. I've tried this with several other channels who are live streaming right now.

There are several other people posting about this same issue. So we are not the only ones experiencing this issue. Google needs to fix something.




回答2:


Update: It seems the problem is fixed by Google, and it works as normal.

I got the same problem, the search API eventType=live gives no results anymore and coding it without eventType shows all videos including the live ones, but there's no way to sort it out because livebroadcastcontent says none even if it is a live one. I hope it's a temporary failure. Changing channelId to channelId doesn't do the thing.

I got a temporary solution as follows. Remove channelId and use a keyword instead q=... this returns a live broadcast. It's not the best or most handy solution, but it helped me a bit. I think YouTube has to solve our problem n with eventType-live for a channelId it still doesn't work.




回答3:


Your kind of search query (that is relative to a given channel) can be replaced with a proper query to the respective channel's uploads playlist.

Upon doing that, do query the Videos endpoint for the set of videos that you determined to be newly added (via the previous call you did to the PlaylistItems endpoint).

For each such video, then reach for the property liveBroadcastContent.




回答4:


It looks like something changed on google's end. Change 'channelId' to 'channelID' and it should work. Their documentation still says channelId, though, so maybe they are going to change it back.



来源:https://stackoverflow.com/questions/57930207/youtube-data-api-no-longer-returns-active-live-streams-from-search-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!