Tutorial

How to Feed YouTube Data into Claude Without Copy-Paste

Stop copy-pasting YouTube transcripts into Claude. Use Scavio's transcript endpoint to pipe video context directly into agent prompts.

Copy-pasting YouTube transcripts into Claude is the slow path. The fast path: Scavio's transcript endpoint returns the typed transcript as JSON, then a small Python or JS wrapper streams it into a Claude message. This tutorial shows the wrapper plus a few patterns for summarizing, fact-checking, and follow-up question Q&A.

Prerequisites

  • Python 3.10+
  • A Scavio API key
  • Anthropic API key

Walkthrough

Step 1: Pull a YouTube transcript

Scavio's transcript endpoint returns text plus timing.

Python
import requests, os
API_KEY = os.environ['SCAVIO_API_KEY']

def transcript(video_id):
    r = requests.post('https://api.scavio.dev/api/v1/youtube/transcript',
        headers={'x-api-key': API_KEY},
        json={'video_id': video_id})
    return r.json().get('transcript', '')

Step 2: Send into Claude

Pass transcript as user-message context.

Python
import anthropic
client = anthropic.Anthropic()

def summarize(video_id):
    t = transcript(video_id)
    msg = client.messages.create(
        model='claude-sonnet-4-6',
        max_tokens=512,
        messages=[{'role': 'user', 'content': f'Summarize in 5 bullets:\n{t[:8000]}'}])
    return msg.content[0].text

Step 3: Fact-check claims

Loop claims against Scavio SERP for citations.

Python
def fact_check(claim):
    r = requests.post('https://api.scavio.dev/api/v1/google',
        headers={'x-api-key': API_KEY},
        json={'query': claim, 'num_results': 5})
    return r.json().get('organic_results', [])

Step 4: Q&A across multiple videos

Concatenate top 3 transcripts, ask Claude.

Python
def multi_video_qa(video_ids, question):
    texts = [transcript(vid)[:3000] for vid in video_ids]
    context = '\n\n'.join(texts)
    msg = client.messages.create(
        model='claude-sonnet-4-6',
        max_tokens=1024,
        messages=[{'role': 'user', 'content': f'{question}\n\n{context}'}])
    return msg.content[0].text

Step 5: Cache transcripts

Avoid repeat calls on the same video.

Python
from functools import lru_cache
@lru_cache(maxsize=200)
def cached_transcript(vid):
    return transcript(vid)

Python Example

Python
import os, requests, anthropic
API_KEY = os.environ['SCAVIO_API_KEY']
client = anthropic.Anthropic()

def summarize_yt(vid):
    t = requests.post('https://api.scavio.dev/api/v1/youtube/transcript',
        headers={'x-api-key': API_KEY}, json={'video_id': vid}).json().get('transcript', '')
    msg = client.messages.create(model='claude-sonnet-4-6', max_tokens=512,
        messages=[{'role':'user','content':f'Summarize: {t[:8000]}'}])
    return msg.content[0].text

print(summarize_yt('dQw4w9WgXcQ'))

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic();
export async function summarizeYt(vid) {
  const r = await fetch('https://api.scavio.dev/api/v1/youtube/transcript', { method: 'POST', headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ video_id: vid }) });
  const t = (await r.json()).transcript || '';
  const msg = await client.messages.create({ model: 'claude-sonnet-4-6', max_tokens: 512, messages: [{ role: 'user', content: `Summarize: ${t.slice(0, 8000)}` }] });
  return msg.content[0].text;
}

Expected Output

JSON
Claude returns a 5-bullet summary of the video. Multi-video Q&A produces grounded answers across 3 transcripts. Fact-check returns 5 SERP citations per claim.

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.10+. A Scavio API key. Anthropic API key. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Stop copy-pasting YouTube transcripts into Claude. Use Scavio's transcript endpoint to pipe video context directly into agent prompts.