YouTube Transcription
Extract transcripts from YouTube videos programmatically. Supports multiple URLs per request and provides detailed response information including success/failure status for each video.
Overview
The YouTube Transcription API allows you to extract transcripts from YouTube videos programmatically. This is useful for content analysis, accessibility, research, or any application that needs to work with YouTube video content in text format.
Authentication
The API supports two authentication methods:
1. API Key Authentication (Recommended)
Include your API key in the request headers:
2. Session Authentication
If you’re making requests from a browser with an active session, authentication will be handled automatically via cookies.
Request Format
Headers
Body
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
urls | string[] | Yes | Array of YouTube URLs to transcribe. Maximum 10 URLs per request. |
Supported YouTube URL Formats
https://www.youtube.com/watch?v=VIDEO_ID
https://youtu.be/VIDEO_ID
https://youtube.com/embed/VIDEO_ID
https://m.youtube.com/watch?v=VIDEO_ID
https://youtube.com/live/VIDEO_ID
Response Format
Success Response (200 OK)
Response Fields
transcripts
Array
Each transcript object contains:
url
(string): The original YouTube URLsuccess
(boolean): Whether the transcript was successfully retrievedtitle
(string, optional): Video title (only if successful)transcript
(string, optional): The full transcript text (only if successful)error
(string, optional): Error message (only if failed)
summary
Object
requested
: Number of URLs provided in the requestprocessed
: Number of valid YouTube URLs found and processedsuccessful
: Number of transcripts successfully retrievedfailed
: Number of transcripts that failedtotalCost
: Total cost in USD for successful transcripts
Error Responses
400 Bad Request
401 Unauthorized
402 Payment Required
429 Too Many Requests
Pricing
- Cost: $0.01 USD per successful transcript
- Billing: You are only charged for successfully retrieved transcripts
- Failed transcripts: No charge
Rate Limits
- 10 requests per minute per IP address
- 10 URLs maximum per request
Code Examples
Best Practices
-
Batch Requests: Send multiple URLs in a single request (up to 10) rather than making individual requests for better efficiency.
-
Error Handling: Always check the
success
field for each transcript, as some videos may not have transcripts available. -
Rate Limiting: Implement exponential backoff if you receive a 429 status code.
-
URL Validation: The API automatically detects and validates YouTube URLs, but validating on your end can save API calls.
-
Cost Monitoring: Use the
summary.totalCost
field to track your spending.
Limitations
-
Transcript Availability: Not all YouTube videos have transcripts available. Videos may lack transcripts if:
- The creator hasn’t enabled auto-captions
- The video is private or age-restricted
- The video has been deleted
- The video is a live stream without captions
-
Language: Transcripts are returned in their original language. The API doesn’t provide translation services.
-
Formatting: Transcripts are returned as plain text with natural line breaks. Timestamp information is not included.
Use Cases
- Content Analysis: Analyze video content for keywords, topics, or sentiment
- Accessibility: Create accessible versions of video content
- Research: Study communication patterns, language use, or content trends
- SEO: Extract content for search engine optimization
- Education: Create study materials from educational videos
- Content Moderation: Check video content for compliance
Support
For technical support or questions about the YouTube Transcription API:
- Email: support@nano-gpt.com
- Documentation: https://docs.nano-gpt.com
- Status Page: https://status.nano-gpt.com
Authorizations
Body
YouTube transcription parameters
The body is of type object
.
Response
YouTube transcription response with results for each URL
The response is of type object
.