Menu

1 / 2

Rate Limiting and API Key Management for YouTube Data API

DEV Community·ahmet gedik·6 months ago
#z9WoniVx
#youtube#api#ratelimiting#backend#null
Reading 0:00
15s threshold

TopVideoHub fetches trending video data from 9 Asia-Pacific regions — US, GB, JP, KR, TW, SG, VN, TH, HK. Each YouTube Data API v3 videos.list call costs 1 unit. Each search.list call costs 100 units. With a default quota of 10,000 units per key per day, we need careful management to keep all 9 regions refreshed.

Here is the full key rotation and rate limiting system.

Quota Anatomy

Operation Units Usage

videos.list (trending, 50 results) 1 Every cron cycle per region

search.list (keyword) 100 On-demand, cached 6h

videoCategories.list 1 Daily, cached 24h

With 9 regions and a 4-hour cron cycle, trending fetches cost 9 × 6 = 54 units/day. Negligible.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.