YouTube Transcript CLI — Extract Transcripts from Terminal
Extract YouTube transcripts directly from the command line. Use curl one-liners, our NPM package, or Python SDK to integrate transcript extraction into shell scripts, CI/CD pipelines, and automation workflows.
QUICK START WITH CURL
The fastest way to get a transcript from your terminal — a single curl command:
curl -H "x-api-key: YOUR_API_KEY" \ "https://youtubetranscript.dev/api/v2/transcript?video=dQw4w9WgXcQ"
USING THE NPM PACKAGE
For more complex workflows, use the NPM package in Node.js scripts:
import { YouTubeTranscript } from "youtube-transcript-api";
const yt = new YouTubeTranscript({ apiKey: process.env.API_KEY });
const result = await yt.getTranscript("dQw4w9WgXcQ");
console.log(result.data?.transcript.text);USING THE PYTHON SDK
Python scripts work great for data processing and analysis pipelines:
from youtubetranscript import YouTubeTranscript
import os
yt = YouTubeTranscript(os.environ["API_KEY"])
result = yt.transcribe("dQw4w9WgXcQ")
print(result.text)CLI TIPS AND TRICKS
Pipe to jq for JSON Processing
Use jq to extract specific fields from the JSON response:
curl -H "x-api-key: KEY" \ "https://youtubetranscript.dev/api/v2/transcript?video=ID" \ | jq '.text'
Save to File
Redirect output to save transcripts directly to files:
curl -H "x-api-key: KEY" \ "https://youtubetranscript.dev/api/v2/transcript?video=ID" \ > transcript.txt
Batch Processing with xargs
Process multiple video URLs from a file:
cat urls.txt | xargs -I{} curl -H "x-api-key: KEY" \
"https://youtubetranscript.dev/api/v2/transcript?video={}"Integration with Shell Scripts
Build automation scripts that extract and process transcripts as part of larger workflows.
USE CASES
CI/CD Pipelines
Extract transcripts as part of content processing pipelines in GitHub Actions, GitLab CI, or Jenkins.
Research Scripts
Batch process video URLs for academic research, content analysis, or dataset building.
Content Automation
Automate transcript extraction with cron jobs, shell scripts, or Makefiles.
Developer Workflows
Quick transcript extraction during development without leaving the terminal.
FREQUENTLY ASKED QUESTIONS
Can I extract YouTube transcripts from the command line?+
Yes. Use curl with the YouTubeTranscript.dev API to extract transcripts in a single command. You can also use our NPM package or Python SDK for more complex CLI workflows.
Do I need an API key for CLI usage?+
Yes. Get your API key from your YouTubeTranscript.dev account settings. Include it as the x-api-key header in your curl requests.
Can I process multiple videos from a file?+
Yes. Put video URLs in a text file (one per line) and use xargs or a simple loop to process them all. Our API handles concurrent requests within your plan's rate limits.
What output formats does the CLI support?+
The API returns JSON by default, which you can process with jq. You can request specific formats (text, SRT, VTT) through the format parameter.