November 23, 2026 · 5 min read
Chat with a YouTube Channel: Build a RAG Knowledge Base from Every Video
In short
Turn a YouTube channel into a chat knowledge base: download every transcript, chunk it with timestamps, embed it, and keep it current with a webhook per upload.
To chat with a YouTube channel, put every video's transcript into a retrieval (RAG) index and let a language model answer from it. With the TranscriptYT API that takes three steps: list the channel's uploads with GET /v1/playlist, fetch the transcripts in batches with POST /v1/transcripts, then chunk them with timestamps and embed them. A watch on the channel sends each new upload's transcript to a webhook, so the knowledge base stays complete without re-crawling.
What you are building
A channel chatbot answers questions like "what has this creator said about index funds?" or "which video explains the torque settings?" with an answer and links to the moments it came from. Underneath it is ordinary retrieval-augmented generation: a store of transcript chunks with embeddings, a search step that finds the chunks closest to the question, and a model that writes the answer from those chunks.
YouTube transcripts suit this well because every chunk can carry a timestamp. A good answer ends with sources like "Episode 42, 18:05", and a click opens the video at that second. For a single video, the free chat with YouTube video tool already does this; the rest of this guide scales it to a channel.
Step 1: download the back catalogue
GET /v1/playlist takes a channel @handle, URL, or ID and returns its uploads, up to 500 per call, free on paid plans. POST /v1/transcripts then takes up to 500 video IDs per request depending on your plan, and returns each transcript with timestamped segments. Videos that fail (private, no captions) come back with ok set to false and cost nothing. The docs list every option, and downloading a whole channel covers it in more detail.
To browse a channel's videos without code first, open the free channel transcripts tool.
import os, requests
API = "https://transcript-yt.com/v1"
H = {"Authorization": "Bearer " + os.environ["TRANSCRIPTYT_KEY"]}
videos = requests.get(API + "/playlist", params={"url": "@hubermanlab", "limit": 500},
headers=H, timeout=120).json()["videos"]
ids = [v["videoId"] for v in videos]
transcripts = []
for i in range(0, len(ids), 50):
batch = requests.post(API + "/transcripts", json={"urls": ids[i:i + 50]},
headers=H, timeout=300).json()
transcripts += [r["transcript"] for r in batch["results"] if r["ok"]]Step 2: chunk with timestamps
Caption segments are a few seconds long, which is too short to embed on their own. Merge consecutive segments until a chunk covers about 90 seconds, and record the start time of its first segment. A small overlap (repeating the last segment of one chunk at the start of the next) stops answers from being cut in half at a boundary.
Store the video ID, title, and start time with every chunk. They cost nothing to keep and they are what turns an answer into a citation.
Auto-generated captions have no punctuation, which makes sentence-based splitters useless; splitting by time is more reliable. If you prefer readable paragraphs, the transcript endpoint can merge segments into paragraph-length chunks for you (see the docs), and those chunks keep their start times.
def chunk(video_id, title, segments, seconds=90):
chunks, cur, start = [], [], None
for seg in segments:
if start is None:
start = seg["start"]
cur.append(seg["text"])
if seg["start"] + seg["duration"] - start >= seconds:
chunks.append({"video_id": video_id, "title": title, "start": int(start),
"text": " ".join(cur)})
cur, start = cur[-1:], seg["start"]
if cur:
chunks.append({"video_id": video_id, "title": title, "start": int(start or 0),
"text": " ".join(cur)})
return chunks
titles = {v["videoId"]: v["title"] for v in videos}
chunks = [c for t in transcripts
for c in chunk(t["videoId"], titles.get(t["videoId"], ""), t["segments"])]Step 3: embed, retrieve, answer
Embed each chunk's text with any embedding model and store the vectors with their metadata in a vector database (pgvector, Chroma, Qdrant, or a plain array for a few thousand chunks). At question time, embed the question, take the 5 to 8 closest chunks, and give them to the model with an instruction to answer only from them and cite video title plus timestamp.
Build each citation link as https://www.youtube.com/watch?v=VIDEO_ID&t=START. If you use LangChain or LlamaIndex, the chunks map directly onto their Document objects; see YouTube transcripts with LangChain.
- Put the channel name and video title in each chunk's text as well as its metadata; it helps retrieval for questions like "in the sleep episode".
- Ask the model to say when the retrieved chunks do not answer the question, instead of filling in from general knowledge.
- For long-running channels, add the upload date to metadata so you can prefer recent videos when advice has changed.
Step 4: keep it current with a watch
A static index goes stale with the next upload. Create a watch on the channel with your webhook URL. Every hour TranscriptYT checks for new uploads, and each one arrives as a POST with video.id, video.title, and transcript.segments, ready for the same chunk function. Verify the X-TranscriptYT-Signature header first; the webhook guide has the code.
# create the watch once
curl -X POST "https://transcript-yt.com/v1/watches" \
-H "Authorization: Bearer $TRANSCRIPTYT_KEY" -H "Content-Type: application/json" \
-d '{"channel": "@hubermanlab", "webhook_url": "https://example.com/hooks/kb", "ai": true}'
# in the webhook handler, after verifying the signature
def on_video(event):
v = event["video"]
new_chunks = chunk(v["id"], v["title"], event["transcript"]["segments"])
index.add(new_chunks) # embed and upsert, keyed by video_id + startCosts and practical limits
Transcripts cost 1 credit each, so indexing a 500-video channel is 500 credits, and keeping it current costs 1 credit per new upload. Listing and watch checks are free. With ai set to true on the watch, new videos without captions are transcribed from audio after 6 hours at 1 credit per started minute, up to 2 hours long. If your webhook is down, deliveries are retried every hour for up to 48 hours at no extra charge.
Watches need a paid plan or credit pack (Micro 5 watches, Starter 20, Growth 100, Scale 300, credit packs 20). Plans are on the API page.
Embedding costs are usually small next to the transcripts. An hour of speech is roughly 9,000 words, so a 500-video channel of 20-minute videos is around 1.5 million words to embed once, and each new upload adds a few thousand.
Common problems and fixes
Most quality issues in a channel chatbot come from retrieval, not from the model. Check what the search step returns for a few test questions before changing prompts.
- Answers mix up episodes: include the video title in the chunk text and show it in citations, so both the model and the reader can tell sources apart.
- Names come back misspelled: auto-generated captions mishear proper nouns. Add a short glossary of the channel's recurring names to the system prompt.
- Sponsor reads pollute results: drop chunks that match the channel's usual sponsor phrases before embedding.
- Duplicate chunks after re-runs: key each chunk by video ID and start time and upsert instead of inserting, so a re-delivered webhook or a repeated backfill changes nothing.
- Missing videos: check the batch results for ok set to false. Videos without captions can be fetched later, or transcribed from audio by setting ai on the watch for new uploads.
Common questions
Can I chat with a whole YouTube channel?
Yes. Download the transcripts of every upload, split them into timestamped chunks, store them in a vector index, and have a language model answer questions from the chunks it retrieves. Each answer can link to the exact moment in the source video.
How much does it cost to index a YouTube channel?
1 credit per video transcript. A 500-video channel is 500 credits, about $1.50 at the Micro rate, plus whatever your embedding provider charges. Listing the channel's videos is free on paid plans.
How do I keep a YouTube channel knowledge base up to date?
Create a TranscriptYT watch on the channel with a webhook URL. Each new upload's transcript is POSTed to your endpoint, where you chunk and embed it the same way as the back catalogue.
What chunk size works for YouTube transcripts?
Around 60 to 120 seconds of speech, or 150 to 300 words, with a short overlap. Keep the start time of each chunk so answers can link to the right moment.