1

I am new to using the YouTube API and I'm trying to better understand the API quota and how I can make my code more efficient.

I have a Python script which uses the YouTube API to get a list of upcoming live streams for a number of my favorite channels. For each channel, I call the .search method to get a list of upcoming stream ids, then the .list method to get start time, title, etc for that list of stream ids. Each search call costs 100 units and each list call costs 1 unit. The daily quota is 10000 units, so I can execute 99 searches/lists per day. Currently, I am updating 6 times a day, limiting the channels I can follow to 16.

Does this all sound like the correct way to do things? Is my understanding of the quota/math correct? What can I do to improve my API use so I can increase the number of channels and the frequency of updates? I expect the streamers might update their schedule daily, but don't know exactly when and I would like to get the updates into the db as soon after they are created.

Biggest bottleneck is the .search call, which apparently only allows you to pass one channel id at a time.

Thanks for any help and pointers.

William Kelley
  • 137
  • 1
  • 2
  • About the quota, since the `search` endpoint is one of the most endpoints that uses more quota, there is not much you can do (*except, maybe asking for more quota*) - or check this [answer](https://stackoverflow.com/a/56510879/4092887) - and related answers as well. – Mauricio Arias Olave May 28 '23 at 20:00

0 Answers0