Using YouTube API v3 to tell if a channel has a live stream -
the goal of youtube api call is, given channelid, return whether channel live streaming. call i'm making currently:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelid={channel_id}&eventtype=live&type=video&key={your_api_key} while call functional, there significant delay between channel starting live stream , call returning stream.
is there better call use in youtube v3 api doesn't require oauth? functionality of app read-only.
thanks!
probably late still else use it, found answer on google api docs:
https://developers.google.com/youtube/v3/live/docs/livebroadcasts/list (scroll bottom, can use onsite api make calls on fly)
the call have make is:
get https://www.googleapis.com/youtube/v3/livebroadcasts?part=id%2csnippet%2cstatus&mine=true&broadcaststatus=active&key={your_api_key} (atm, have issue wth status field). can remove filter , check returned results
{ "status": { "lifecyclestatus": "live"}} and per google docs:
before start
you need google account access google developers console, request >api key, , register application. register application google can submit api requests. after registering application, select youtube data api 1 of >services application uses:
go developers console , select project registered. open api library in google developers console. if prompted, select >project or create new one. in list of apis, make sure status on >the youtube data api v3 and, if youtube content partner, youtube >content id api.
calling data api
the api request must authorized google account owns >broadcasting youtube channel.
you can check link generating access(oauth 2.0) token: https://developers.google.com/identity/protocols/oauth2?hl=en
i hope helps.
Comments
Post a Comment