YouTube data API cost per request or per object?

2020-03-31 12:12发布

问题:

I get that there is a cost incurred when I use YouTube API service, but what I would like to know is if the cost is per request or not. For example, when I query the meta data of 3 videos, would the cost be tripled for that one request, or would the cost be the same as if I query the meta data for 1 video?

回答1:

I assume you talk about the quota with the YouTube API v3, i can suggest you to visit this link, a quota calculator:

This tool lets you estimate the quota cost for an API query. All API requests, including invalid requests, incur a quota cost of at least one point.

https://developers.google.com/youtube/v3/determine_quota_cost COST 3

  • would the cost be tripled for that one request, or would the cost be the same as if I query the meta data for 1 video?

We can assume "cost be the same as if I query the meta data for 1 video" because they speaks about "request" like this :

  • GET https://www.googleapis.com/youtube/v3/videos?part=snippet COST 3

The request for multiple videos is like this :

  • GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=zMbIipvQL0c%2CLOcKckBLouM&key={YOUR_API_KEY}

Which is also one request, so it's also a cost of 3 !

The real deal is when you have multiple pages:

Note: If your application calls a method, such as search.list, that returns multiple pages of results, each request to retrieve an additional page of results will incur the estimated quota cost.