When you extract a YouTube transcript, you often need the video's metadata too: the title, channel name, and duration. The YouTube Data API requires its own API key and has complex quota limits. YouTubeTranscripts.co includes metadata in every transcript response, so you get everything you need in a single API call.
Metadata Included in Every Response
Every transcript response from YouTubeTranscripts.co includes the video title, channel name, and total duration in seconds. You do not need a separate API call or a YouTube Data API key.
import httpx
response = httpx.get(
"https://api.youtubetranscripts.co/v1/transcript",
params={"url": "https://youtube.com/watch?v=dQw4w9WgXcQ"},
headers={"x-api-key": "YOUR_API_KEY"},
)
data = response.json()
print(f"Title: {data['title']}")
print(f"Channel: {data['channel']}")
print(f"Duration: {data['duration']} seconds ({data['duration'] // 60} min)")Using Metadata for Organization
Use the metadata to organize, filter, and categorize your transcripts.
# Organize transcripts by channel
from collections import defaultdict
transcripts_by_channel = defaultdict(list)
for item in all_transcripts:
transcripts_by_channel[item["channel"]].append({
"title": item["title"],
"duration": item["duration"],
"word_count": len(" ".join(s["text"] for s in item["transcript"]).split()),
})
for channel, videos in transcripts_by_channel.items():
total_duration = sum(v["duration"] for v in videos)
print(f"{channel}: {len(videos)} videos, {total_duration // 3600}h total")Building a Video Database
Combine metadata and transcripts to build a searchable video database.
import sqlite3
import json
conn = sqlite3.connect("videos.db")
conn.execute("""
CREATE TABLE IF NOT EXISTS videos (
url TEXT PRIMARY KEY,
title TEXT,
channel TEXT,
duration INTEGER,
transcript TEXT,
word_count INTEGER
)
""")
for item in all_transcripts:
text = " ".join(s["text"] for s in item["transcript"])
conn.execute(
"INSERT OR REPLACE INTO videos VALUES (?, ?, ?, ?, ?, ?)",
(item["url"], item["title"], item["channel"], item["duration"], text, len(text.split())),
)
conn.commit()
print(f"Stored {len(all_transcripts)} videos in database")Metadata in Batch Responses
Batch responses include metadata for every video, making it easy to process and catalog large sets of videos.
Conclusion
YouTubeTranscripts.co gives you both transcripts and metadata in a single API call. No need for the YouTube Data API or additional API keys. Use the metadata to organize, filter, and build databases of video content. Get started at youtubetranscripts.co.
Ready to start extracting YouTube transcripts?
Get 150 free API requests. No credit card required.
Get Your Free API Key