0

I'm trying to get "ALL" game live streams from youtube using API.

The way I first used is through "Search.list" with parameters: https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&eventType=live&maxResults=50&type=video&videoCategoryId=20. But in this way when I try to iterate results using PageToken, I can only get around 100 results while in the API response I can see "totalResults" is around 2000. Then I came into this topic and realized that "Search.list" is actually kind of "ranking" algorithm instead of "fetch all data from DB", which means "totalResults" is just an estimated number of results.

Then I came to use "liveBroadcasts.list" but it returns no results: https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.liveBroadcasts.list?part=id&broadcastStatus=active&maxResults=50&_h=8&

And for other APIs, they either need channelId or other ids.

Is there any way to get all game live streams regardless of any ids?

Community
  • 1
  • 1
Yang Yu
  • 103
  • 5

1 Answers1

0

According to Youtube Category ID list, Gaming resides on number 20 category. In case you want to try a different category in the future, instead of videoCategoryId=20, you can try videoCategoryId=31 - that's for Anime/Animation.

Try to run this on your browser to get all live streams:

https://www.googleapis.com/youtube/v3/search?part=snippet&eventType=live&type=video&videoCategoryId=20&regionCode=US&maxResults=50&key=SERVER_API_KEY_HERE
ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
  • Thanks. But this is just the way that I first tried in my question, the problem is I can only get partial results instead of all results - after iterating 2 to 3 pages there are no results any more, although the response from the api said there will be 2000 results. – Yang Yu May 27 '16 at 07:03
  • I'm having the same problem. Did you find any solution? – AndrejH Oct 12 '18 at 09:59
  • 1
    yes but this api cost too much ... 1 query costs 100 in quota ... – rednaks Jul 15 '20 at 19:41