
The YouTube Data API v3 is Google's official REST API for YouTube. It reads and writes the public side of the platform: search, videos, channels, playlists, comments, captions metadata and subscriptions.
It doesn't download videos or give you transcripts. For that I use YT-DLP.
How the cost works: quota units
The API is free, but every call costs quota units, and a Google Cloud project gets 10,000 units a day by default. The count resets at midnight Pacific Time.
| Call | Cost | What it returns |
|---|---|---|
search.list |
100 units | Up to 50 video, channel or playlist IDs for a query |
videos.list |
1 unit | Details of up to 50 videos: title, description, stats |
channels.list |
1 unit | Channel details, uploads playlist |
playlistItems.list |
1 unit | The videos in a playlist, 50 per page |
commentThreads.list |
1 unit | Up to 100 top-level comments per page |
videos.insert |
100 units | An upload (write calls need OAuth) |
Every page is a new call, and even an invalid request costs at least 1 unit. The maths is simple: search is expensive, reading is cheap. 10,000 units buy 100 searches, or 10,000 pages of details.
⚠️ WARNING: to list a channel's videos, don't search. Read the channel's uploads playlist with
playlistItems.listat 1 unit a page instead of 100.
More quota needs a quota extension request and a compliance audit by Google.
How to call it
Read-only calls need only an API key from the Google Cloud Console (enable "YouTube Data API v3" on the project). Writes and private data need OAuth 2.0.
import json, os, urllib.parse, urllib.request
API = "https://www.googleapis.com/youtube/v3"
key = os.environ["YOUTUBE_API_KEY"]
def yt(endpoint: str, **params) -> dict:
params["key"] = key
with urllib.request.urlopen(f"{API}/{endpoint}?{urllib.parse.urlencode(params)}", timeout=30) as r:
return json.load(r)
ids = [i["id"]["videoId"] for i in yt("search", part="snippet", q="best field watches",
type="video", maxResults=25)["items"]] # 100 units
videos = yt("videos", part="snippet", id=",".join(ids))["items"] # 1 unit
for v in videos:
print(v["snippet"]["title"])
A 403 with quotaExceeded in the body means the day is over: stop, don't retry.
How I use it in NicAI
Brand discovery for indexAll - indexes of brands, apps, and tools. IndexAll is my set of curated indexes of brands and apps. Reviewers on YouTube link the brands they test in their descriptions, so YouTube is a good place to find small brands nobody lists yet.
youtube.py in IndexAll does it in 4 steps:
- Search each index's queries (for example "best field watches") with
search.list. Each index has its own query list, which Perplexity can populate for me. - Read the descriptions of the results with
videos.list, 50 videos per call. - Optionally read the comments with
commentThreads.list, up to 3 pages per video. - Extract the URLs, drop the noise (social networks, marketplaces, link shorteners, affiliate trackers, retailers) and send the rest through the same pipeline as my Reddit scraper: deduplicate, research each candidate with Perplexity, insert it into the IndexAll database.
Before a run, youtube.py quota estimates the units it will spend against the 10,000 a day, and warns when a run would go over. A scrape on the watches index found 9 new brands in one go.
Where I don't use it. Finding a talk by a given person, or the transcript of a video, doesn't need the API:
- My YouTube helper
yt.pyreads metadata, transcripts, audio and video with yt-dlp (see YT-DLP). - My video search skill searches YouTube through the browser, with the API only as an optional upgrade.
The main limitation: search relevance is tuned for viewers, not for research. Many results are retailers or big brands, and a scrape still needs a human pass to remove non-brands.
Further reading

