Answers
How do I search YouTube channels by keyword and get their subscriber counts with an API?
Short answer
okdata YouTube channel search returns 20 channels a page with their subscriber counts for $0.004, so you can keep a subscriber band straight from the results; YouTube channel videos then lists a channel's latest 30 or so uploads with views for $0.002. Finding 200 cooking channels with 10k to 500k subscribers and reading their last 30 videos costs $0.56, with no daily quota and no Google Cloud project. On the official Data API the same job fits one day's default quota if you search with type=channel and maxResults=50, read subscribers from channels.list, and list videos through each channel's uploads playlist instead of calling search.list once per channel.
A kitchenware brand selling in the US and UK wants 200 cooking channels with 10,000 to 500,000 subscribers, big enough to matter and small enough to answer an email. For each one the team wants the last 30 videos and their views, because a channel's recent views say more about its reach than its subscriber count. Nobody has the list yet; it starts from keywords.
Where the Data API quota goes
Google's quota page (read 2026-11-17) gives a project 100 search.list calls a day in a bucket of their own, plus 10,000 units a day for everything else; channels.list, playlistItems.list and videos.list cost 1 unit a call. Every extra page of search results is another call. Why the search bucket runs out covers the general case; for channel discovery, three habits decide whether the job fits:
| Step | Data API call | Bucket | For this job |
|---|---|---|---|
| Find channels | search.list with type=channel, maxResults=50 |
100 searches a day | 10 phrases × 2 pages = 20 searches |
| Subscribers and uploads playlist | channels.list with part=statistics,contentDetails and a comma-separated list of IDs |
10,000 units | at most 1 unit per candidate, far less in batches |
| Latest videos | playlistItems.list on contentDetails.relatedPlaylists.uploads |
10,000 units | 200 |
| Views of those videos | videos.list with part=statistics |
10,000 units | 200 |
Done this way, one run uses 20 of the 100 daily searches and well under a fifth of the 10,000 units. Two common mistakes blow the budget. Leaving maxResults at its default of 5 makes 1,000 candidate channels cost 200 searches, two days of quota. Listing each channel's videos with search.list and channelId spends one search per channel, so 200 channels need two days as well. Search results also carry no subscriber counts (the snippet holds title, description and thumbnails), which is why channels.list is a separate step. For more on its rounded subscriberCount, see YouTube channel subscriber counts.
The same job with okdata
- Search. YouTube channel search takes
queryand returns 20 channels a page in YouTube's order:id(the UC… channel ID),name,bio(the start of the description),avatar_urlandfollowers, the subscriber count as YouTube shows it (245K comes back as 245000). Page withcursor. - Filter. Keep rows whose
followersfalls in your band and de-duplicate byid, since the same channel shows up under several phrases. - Videos. YouTube channel videos takes the channel
idand returns the newest 30 or so uploads with title,metrics.viewsand an approximatepublished_at. One page is roughly the last 30. Addtype=shortfor the channel's Shorts. - Optional: country. Channel search has no region filter. YouTube channel profile with
view=fulladdsext.country, total views and join date, so you can keep US and UK channels only.
Channel search finds channels the way YouTube's search does when you filter it to channels. To also catch cooks whose channel name never says "recipe", run the same phrases through YouTube video search ($0.004 a page of about 20 videos) and collect author.id from the results; those rows have no subscriber count, so look new channels up with the profile endpoint.
import csv, os, statistics, requests
API = "https://api.okdata.online"
H = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}
def get(path, **params):
body = requests.get(API + path, headers=H, params=params, timeout=60).json()
if body["code"] != "ok":
raise RuntimeError(f"{body['code']}: {body['message']}")
return body
PHRASES = ["easy dinner recipes", "meal prep", "home baking", "vegan cooking", "air fryer recipes",
"one pot meals", "sourdough", "budget cooking", "healthy recipes", "weeknight dinners"]
LOW, HIGH, WANT = 10_000, 500_000, 200
found = {}
for q in PHRASES:
cursor = None
for _ in range(4): # 4 pages per phrase
body = get("/v1/youtube/channels/search", query=q, **({"cursor": cursor} if cursor else {}))
for ch in body["data"]["items"]:
if ch["followers"] is not None and LOW <= ch["followers"] <= HIGH:
found.setdefault(ch["id"], ch)
if not body["page"]["has_more"]:
break
cursor = body["page"]["next_cursor"]
with open("cooking_channels.csv", "w", newline="", encoding="utf-8") as f:
w = csv.writer(f)
w.writerow(["channel_id", "name", "subscribers", "videos_read", "median_views"])
for ch in list(found.values())[:WANT]:
vids = get("/v1/youtube/channels/videos/list", id=ch["id"])["data"]["items"]
views = [v["metrics"]["views"] for v in vids if v["metrics"]["views"] is not None]
w.writerow([ch["id"], ch["name"], ch["followers"], len(vids),
int(statistics.median(views)) if views else ""])
What the job costs
| Step | Calls | Cost |
|---|---|---|
| Channel search, 10 phrases × 4 pages (up to 800 rows) | 40 | $0.16 |
| Last 30 or so videos for 200 channels | 200 | $0.40 |
| Whole job | 240 | $0.56 |
| Optional: country, total views and join date for the 200 | 200 | $0.40 |
| 1,000 channel search rows | 50 | $0.20 |
If 800 rows leave fewer than 200 channels in the band, add phrases. It is pay per call with no subscription, each endpoint has its own price on the pricing page, and a new key gets $0.10 of credit.
Or ask an agent
Add the MCP server (https://api.okdata.online/mcp) to Claude, Cursor or another MCP client with your key, then ask: "Find 50 YouTube channels about home baking with 10k to 500k subscribers, and give each one's median views over its last 30 videos." The agent calls the same two endpoints. Ask it to say how many search pages it plans to read before it starts.
Limits
- Subscriber counts are rounded the way YouTube rounds them, and Google's own
subscriberCountis rounded down to three significant figures, so no route gives an exact number. A channel that hides its count comes back withfollowersnull. - Channel search has no language, region or subscriber filter. Write the phrases in your market's language and filter on
followersyourself. - Search rows have no handle, verification badge or video count; the profile endpoint has the badge and video count. Channel IDs and handles explains which identifier to store.
- The video list is newest first only, its publish times are approximate ("3 weeks ago"), and it carries no likes or comment counts. Shorts in the
type=shortlist have no publish time.
When the official API is the better fit
For a one-off list, the Data API's default quota is enough if you follow the table above, and it has things this route lacks: regionCode and relevanceLanguage on search, and exact publish times from the uploads playlist. okdata fits when the 100-search bucket is the bottleneck, such as daily discovery across many niches or markets, when you would rather not run a Google Cloud project and key, or when an agent does the searching. The creator discovery page runs the same method across platforms.
Sources
- YouTube Data API: Quota Calculator (default allocation, search.list bucket)
- YouTube Data API: Search: list (type, maxResults, quota impact)
- YouTube Data API: Channels resource (statistics, uploads playlist)
- YouTube Data API: PlaylistItems: list
- YouTube Data API: PlaylistItems resource (videoPublishedAt)
- YouTube Data API: Videos: list
Where people asked this (read 2026-11-17)
Updated