# How do I search YouTube channels by keyword and get their subscriber counts with an API?

> Find YouTube channels by keyword with subscriber counts in the results, keep a subscriber band, then list each channel's latest videos. Data API quota math, Python and prices.

Canonical page: https://okdata.online/answers/youtube-channel-search-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](/answers/youtube-search-quota-exceeded/) 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](/answers/youtube-channel-subscriber-count-api/).

## The same job with okdata

1. **Search.** [YouTube channel search](/apis/youtube/channels/search/) takes `query` and returns 20 channels a page in YouTube's order: `id` (the UC… channel ID), `name`, `bio` (the start of the description), `avatar_url` and `followers`, the subscriber count as YouTube shows it (245K comes back as 245000). Page with `cursor`.
2. **Filter.** Keep rows whose `followers` falls in your band and de-duplicate by `id`, since the same channel shows up under several phrases.
3. **Videos.** [YouTube channel videos](/apis/youtube/channels/videos/list/) takes the channel `id` and returns the newest 30 or so uploads with title, `metrics.views` and an approximate `published_at`. One page is roughly the last 30. Add `type=short` for the channel's Shorts.
4. **Optional: country.** Channel search has no region filter. [YouTube channel profile](/apis/youtube/channels/get/) with `view=full` adds `ext.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](/apis/youtube/videos/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.

```python
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](/pricing/), and a new key gets $0.10 of credit.

## Or ask an agent

Add the [MCP server](/mcp/) (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 `subscriberCount` is rounded down to three significant figures, so no route gives an exact number. A channel that hides its count comes back with `followers` null.
- Channel search has no language, region or subscriber filter. Write the phrases in your market's language and filter on `followers` yourself.
- Search rows have no handle, verification badge or video count; the profile endpoint has the badge and video count. [Channel IDs and handles](/answers/youtube-video-channel-id-handle/) 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=short` list 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](/solutions/creator-discovery/) page runs the same method across platforms.

## Endpoints used

- [YouTube channel search](https://okdata.online/apis/youtube/channels/search/) `youtube.channels.search`: $0.004 per call · about 20 accounts per page
- [YouTube channel videos](https://okdata.online/apis/youtube/channels/videos/list/) `youtube.channels.videos.list`: $0.002 per call · about 30 videos per page
- [YouTube channel profile](https://okdata.online/apis/youtube/channels/get/) `youtube.channels.get`: $0.002 per call
- [YouTube video search](https://okdata.online/apis/youtube/videos/search/) `youtube.videos.search`: $0.004 per call · about 20 videos per page

## More about YouTube

- [YouTube API](https://okdata.online/apis/youtube/)
- [How to export YouTube comments for every video on a topic](https://okdata.online/guides/youtube-comments-export/)
- [How to get YouTube video transcripts from a keyword search](https://okdata.online/guides/youtube-video-transcript/)
- [How do I get a YouTube channel's subscriber count and stats through an API?](https://okdata.online/answers/youtube-channel-subscriber-count-api/)
- [How do I download transcripts for hundreds of YouTube videos at once?](https://okdata.online/answers/bulk-youtube-transcripts/)
- [How can I know what a social data job will cost before I run it?](https://okdata.online/answers/estimate-data-api-cost-before-running/)
- [Should I use a platform's official API or a third-party social data API?](https://okdata.online/answers/official-api-vs-third-party-social-data/)
- [Is there one API to track a brand across TikTok, YouTube and X?](https://okdata.online/answers/social-listening-api-tiktok-youtube-x/)
- [Official platform APIs vs third-party data APIs (2026)](https://okdata.online/compare/official-apis-vs-data-apis/)
- [How to choose a social media data API (2026)](https://okdata.online/compare/social-media-data-apis/)
- [Post search API](https://okdata.online/roles/posts-search/)

## Sources

- [YouTube Data API: Quota Calculator (default allocation, search.list bucket)](https://developers.google.com/youtube/v3/determine_quota_cost) (read 2026-11-17)
- [YouTube Data API: Search: list (type, maxResults, quota impact)](https://developers.google.com/youtube/v3/docs/search/list) (read 2026-11-17)
- [YouTube Data API: Channels resource (statistics, uploads playlist)](https://developers.google.com/youtube/v3/docs/channels) (read 2026-11-17)
- [YouTube Data API: PlaylistItems: list](https://developers.google.com/youtube/v3/docs/playlistItems/list) (read 2026-11-17)
- [YouTube Data API: PlaylistItems resource (videoPublishedAt)](https://developers.google.com/youtube/v3/docs/playlistItems) (read 2026-11-17)
- [YouTube Data API: Videos: list](https://developers.google.com/youtube/v3/docs/videos/list) (read 2026-11-17)

Where people asked this (read 2026-11-17): 

- https://stackoverflow.com/questions/79020278
- https://stackoverflow.com/questions/70125353
- https://stackoverflow.com/questions/66035288

Updated 2026-11-17
