Mind gem
Mind gem

Reputation: 134

YouTube API - Get live streams by channelIds

How do you query multiple channels to see if they are streaming at that moment?

I tried to add multiple channelIds in this query:

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

That only gives the result of the first key

Upvotes: 2

Views: 7139

Answers (1)

Android Enthusiast
Android Enthusiast

Reputation: 4960

You can use Channels:list, which returns a collection of more than one channel.

HTTP request

GET https://www.googleapis.com/youtube/v3/channels

From the parameter part, it will give you contentDetails part=contentDetails

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "youtube#channelListResponse",
  "etag": etag,
  "nextPageToken": string,
  "prevPageToken": string,
  "pageInfo": {
    "totalResults": integer,
    "resultsPerPage": integer
  },
  "items": [
    channel Resource
  ]
}

Based from Ibrahim Ulukaya, you can not add comma separated channels here. Either you can leave it blank to search all channels, or you can have a request per each channel and merge results. There is no multichannel search API.

Upvotes: 1

Related Questions