Moebits/youtube.ts

Bulk channel request? Function quota unit cost?

Closed this issue · 1 comments

Hi,
Thank you very much for creating this amazing library, I really appreciate it.

I have and application where I would like to fetch the statistics (subscriberCount, videoCount, etc...) for 50+ channels of which I have their YoutubeSubscription object.
Using the YouTube API bare, I could fetch the statistics using a single request by comma-separating the channel ids.
However, I couldn't figure out how to do that with this library.
I saw that there was a YoutubeChannelStatistics object under YoutubeChannel, so I could make a request for each channel.
However, I don't see this solution viable, as I would probably blow through my API quota really quickly.
I'm now wondering how many quota units each request/function costs.
Could we add this to the documentation?

Thank you,
Silvio

I can see that my code forces only one channel id, but you can just call the api directly.

const channels = await youtube.api.get("channel", {id: "ids"}).then((r) => r.items) as YoutubeChannel[]

Quota cost is 1. Documentation at https://developers.google.com/youtube/v3/docs/channels/list