Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if YouTube channel is streaming live

Tags:

I can't find any informations to check if a YouTube channel is actually streaming or not. With Twitch you just need the channel name, and with the API you can check if there is a live or not.

I don't want to use OAuth, normally a public API key is enough. Like checking the videos of a channel I want to know if the channel is streaming.

like image 775
mpgn Avatar asked Sep 08 '15 09:09

mpgn


People also ask

Can you tell who is watching YouTube live?

On the Live tab, select a live stream. From the left menu, select Analytics. From the top menu, select Engagement. Look for the Concurrent viewers report.


2 Answers

You can do this by using search.list and specifying the channel ID, setting the type to video, and setting eventType to live.

For example, when I searched for:

https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCXswCcAMb5bvEUIDEzXFGYg&type=video&eventType=live&key=[API_KEY]

I got the following:

 {  "kind": "youtube#searchListResponse",  "etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/gE5P_aKHWIIc6YSpRcOE57lf9oE\"",  "pageInfo": {   "totalResults": 1,   "resultsPerPage": 5  },  "items": [   {    "kind": "youtube#searchResult",    "etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/H-6Tm7-JewZC0-CW4ALwOiq9wjs\"",    "id": {     "kind": "youtube#video",     "videoId": "W4HL6h-ZSws"    },    "snippet": {     "publishedAt": "2015-09-08T11:46:23.000Z",     "channelId": "UCXswCcAMb5bvEUIDEzXFGYg",     "title": "Borussia Dortmund vs St. Pauli 1-0 Live Stream",     "description": "Borussia Dortmund vs St. Pauli Live Stream Friendly Match.",     "thumbnails": {      "default": {       "url": "https://i.ytimg.com/vi/W4HL6h-ZSws/default.jpg"      },      "medium": {       "url": "https://i.ytimg.com/vi/W4HL6h-ZSws/mqdefault.jpg"      },      "high": {       "url": "https://i.ytimg.com/vi/W4HL6h-ZSws/hqdefault.jpg"      }     },     "channelTitle": "",     "liveBroadcastContent": "live"    }   }  ] } 
like image 82
not_a_bot Avatar answered Sep 23 '22 19:09

not_a_bot


The search-method (https://www.googleapis.com/youtube/v3/search) is awfully expensive to use though. It costs 100 quota units (https://developers.google.com/youtube/v3/determine_quota_cost) out of the 10,000 you have by default. This means you only get 100 requests per day which is terrible.

You could request an increase in the quota but that seems like brute forcing the the problem.

Is there really no other simpler method?

like image 22
Smorfty Avatar answered Sep 23 '22 19:09

Smorfty