Quick Start Guide
Quick Start Guide
Section titled “Quick Start Guide”This guide will help you make your first API call in under 5 minutes. Let’s get started!
Prerequisites
Section titled “Prerequisites”Before you begin, you’ll need:
- A RapidAPI account (free to create)
- An active subscription to one of our APIs
- Your RapidAPI key
Step 1: Get Your API Key
Section titled “Step 1: Get Your API Key”- Go to RapidAPI and sign in
- Subscribe to one of our APIs (start with the free tier!)
- Navigate to the API’s Endpoints page
- Find your API Key in the header parameters section
- Copy the key - you’ll need it for all requests
Your key will look like this:
x-rapidapi-key: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6Step 2: Choose Your API
Section titled “Step 2: Choose Your API”Select the API that best fits your needs:
Subtitles Downloader
Section titled “Subtitles Downloader”Best for: Extracting subtitles in various formats
curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/watch?v=z_bX3runikk&format=srt&language=en" \ -H "x-rapidapi-key: YOUR_RAPIDAPI_KEY" \ -H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com"Summarizer
Section titled “Summarizer”Best for: AI-Driven video summaries
curl -X POST "https://youtube-summarizer-api1.p.rapidapi.com/summarize?url=https://www.youtube.com/watch?v=z_bX3runikk&type=brief&language=en" \ -H "x-rapidapi-key: YOUR_RAPIDAPI_KEY" \ -H "x-rapidapi-host: youtube-summarizer-api1.p.rapidapi.com"Timestamps Generator
Section titled “Timestamps Generator”Best for: Automatic chapter creation
curl -X POST "https://youtube-timestamps-generator-api.p.rapidapi.com/generate?url=https://www.youtube.com/watch?v=z_bX3runikk" \ -H "x-rapidapi-key: YOUR_RAPIDAPI_KEY" \ -H "x-rapidapi-host: youtube-timestamps-generator-api.p.rapidapi.com"Step 3: Make Your First Request
Section titled “Step 3: Make Your First Request”Let’s make a simple request using different methods:
Using cURL (Command Line)
Section titled “Using cURL (Command Line)”curl -X POST "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=https://www.youtube.com/watch?v=z_bX3runikk&format=srt&language=en" \ -H "x-rapidapi-key: YOUR_RAPIDAPI_KEY" \ -H "x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com"Using JavaScript (Fetch)
Section titled “Using JavaScript (Fetch)”async function testAPI() { const videoUrl = encodeURIComponent('https://www.youtube.com/watch?v=z_bX3runikk'); const url = `https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=${videoUrl}&format=srt&language=en`;
const response = await fetch(url, { method: 'POST', headers: { 'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY', 'x-rapidapi-host': 'youtube-subtitles-downloader-api.p.rapidapi.com' } });
const data = await response.json(); console.log(data);}
testAPI();Using Python
Section titled “Using Python”import requestsfrom urllib.parse import urlencode, quote
video_url = 'https://www.youtube.com/watch?v=z_bX3runikk'base_url = 'https://youtube-subtitles-downloader-api.p.rapidapi.com/download'
params = { 'url': video_url, 'format': 'srt', 'language': 'en'}
headers = { 'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY', 'x-rapidapi-host': 'youtube-subtitles-downloader-api.p.rapidapi.com'}
url = f"{base_url}?{urlencode(params, quote_via=quote)}"response = requests.post(url, headers=headers)print(response.json())Using PHP
Section titled “Using PHP”<?php$videoUrl = urlencode('https://www.youtube.com/watch?v=z_bX3runikk');$url = "https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url={$videoUrl}&format=srt&language=en";
$headers = [ 'x-rapidapi-key: YOUR_RAPIDAPI_KEY', 'x-rapidapi-host: youtube-subtitles-downloader-api.p.rapidapi.com'];
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);curl_close($ch);
echo $response;?>Step 4: Understand the Response
Section titled “Step 4: Understand the Response”Success Response
Section titled “Success Response”{ "success": true, "video_id": "z_bX3runikk", "video_title": "Matthew McConaughey's Concerns Over AI", "video_duration": 914, "language": "en", "format": "srt", "total_segments": 469, "total_characters": 15409, "processing_time_ms": 1234, "subtitles": "1\n00:00:00,000 --> 00:00:02,500\nIn this episode..."}Error Response
Section titled “Error Response”{ "error": "Invalid YouTube URL"}Common First-Time Issues
Section titled “Common First-Time Issues””Invalid API Key”
Section titled “”Invalid API Key””Problem: Your API key is incorrect or not properly formatted.
Solution:
- Double-check your API key from RapidAPI
- Ensure you’re using the correct header name:
x-rapidapi-key - Verify you’ve subscribed to the API on RapidAPI
”Rate Limit Exceeded”
Section titled “”Rate Limit Exceeded””Problem: You’ve made too many requests in the current time window.
Solution:
- Check your plan’s rate limits
- Implement request throttling
- Consider upgrading to a higher plan
”Invalid YouTube URL”
Section titled “”Invalid YouTube URL””Problem: The URL format is not recognized.
Solution: Use complete YouTube URLs in these formats:
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://www.youtube.com/shorts/VIDEO_ID
”No captions available”
Section titled “”No captions available””Problem: The video doesn’t have subtitles/captions.
Solution:
- Verify the video has captions on YouTube
- Try a different video for testing
- Check if captions are available in your requested language
Next Steps
Section titled “Next Steps”Now that you’ve made your first successful request, here’s what to do next:
1. Explore All Features
Section titled “1. Explore All Features”Each API has multiple features and options. Check out:
- Different output formats (for Subtitles API)
- Various summary types (for Summarizer API)
- Timestamp customization (for Timestamps API)
2. Build Error Handling
Section titled “2. Build Error Handling”Implement robust error handling in your application:
async function safeAPICall(url, options) { try { const response = await fetch(url, options);
if (!response.ok) { const error = await response.json(); throw new Error(error.error || 'API request failed'); }
return await response.json(); } catch (error) { console.error('API Error:', error.message); throw error; }}3. Implement Caching
Section titled “3. Implement Caching”Save API calls and improve performance with caching:
const cache = new Map();const CACHE_DURATION = 3600000;
async function cachedAPICall(cacheKey, apiCall) { const cached = cache.get(cacheKey);
if (cached && Date.now() - cached.timestamp < CACHE_DURATION) { return cached.data; }
const data = await apiCall(); cache.set(cacheKey, { data, timestamp: Date.now() }); return data;}4. Monitor Your Usage
Section titled “4. Monitor Your Usage”Keep track of your API usage to avoid hitting limits:
let requestCount = 0;let resetTime = Date.now() + 3600000;
function canMakeRequest(maxRequests) { if (Date.now() > resetTime) { requestCount = 0; resetTime = Date.now() + 3600000; } return requestCount < maxRequests;}
async function rateLimitedRequest(apiCall, maxRequests = 100) { if (!canMakeRequest(maxRequests)) { throw new Error('Rate limit would be exceeded'); } requestCount++; return await apiCall();}Real-World Examples
Section titled “Real-World Examples”Example 1: Build a Subtitle Downloader Tool
Section titled “Example 1: Build a Subtitle Downloader Tool”async function downloadSubtitles(videoUrl, format = 'srt') { const encodedUrl = encodeURIComponent(videoUrl); const url = `https://youtube-subtitles-downloader-api.p.rapidapi.com/download?url=${encodedUrl}&format=${format}&language=en`;
const response = await fetch(url, { method: 'POST', headers: { 'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY', 'x-rapidapi-host': 'youtube-subtitles-downloader-api.p.rapidapi.com' } });
const data = await response.json();
if (data.success) { const blob = new Blob([data.subtitles], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `subtitles.${format}`; a.click(); }}Example 2: Video Summary Generator
Section titled “Example 2: Video Summary Generator”async function getVideoSummary(videoUrl, summaryType = 'brief') { const encodedUrl = encodeURIComponent(videoUrl); const url = `https://youtube-summarizer-api1.p.rapidapi.com/summarize?url=${encodedUrl}&type=${summaryType}&language=en`;
const response = await fetch(url, { method: 'POST', headers: { 'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY', 'x-rapidapi-host': 'youtube-summarizer-api1.p.rapidapi.com' } });
const data = await response.json();
if (data.success) { return { title: data.video_title, summary: data.summary, language: data.language_name, duration: data.video_duration }; }}Example 3: Chapter Timestamp Generator
Section titled “Example 3: Chapter Timestamp Generator”async function generateChapters(videoUrl) { const encodedUrl = encodeURIComponent(videoUrl); const url = `https://youtube-timestamps-generator-api.p.rapidapi.com/generate?url=${encodedUrl}`;
const response = await fetch(url, { method: 'POST', headers: { 'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY', 'x-rapidapi-host': 'youtube-timestamps-generator-api.p.rapidapi.com' } });
const data = await response.json();
if (data.success) { return { chapters: data.timestamps, youtubeFormat: data.youtube_description_format, totalChapters: data.total_chapters }; }}Testing Tips
Section titled “Testing Tips”Use Well-Known Videos for Testing
Section titled “Use Well-Known Videos for Testing”These videos are verified to work with all APIs:
- Long video:
https://www.youtube.com/watch?v=z_bX3runikk(15 min) - YouTube Short:
https://www.youtube.com/shorts/ivTdEQ6wseU(34 sec)
Test Different Scenarios
Section titled “Test Different Scenarios”- Short Videos (< 5 minutes)
- Medium Videos (5-30 minutes)
- Long Videos (30+ minutes, based on your plan)
- Different Languages
- YouTube Shorts
Use the Health Check Endpoint
Section titled “Use the Health Check Endpoint”Before making requests, verify the API is operational:
async function checkAPIHealth(apiHost) { const response = await fetch(`https://${apiHost}/health`, { headers: { 'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY', 'x-rapidapi-host': apiHost } }); return await response.json();}
console.log(await checkAPIHealth('youtube-subtitles-downloader-api.p.rapidapi.com'));Performance Optimization
Section titled “Performance Optimization”Parallel Processing
Section titled “Parallel Processing”Process multiple videos concurrently:
async function processMultipleVideos(urls) { const promises = urls.map(url => downloadSubtitles(url)); const results = await Promise.allSettled(promises);
return results.map((result, index) => ({ url: urls[index], success: result.status === 'fulfilled', data: result.status === 'fulfilled' ? result.value : null, error: result.status === 'rejected' ? result.reason : null }));}Request Queuing
Section titled “Request Queuing”Queue requests to respect rate limits:
class APIQueue { constructor(maxConcurrent = 5, delayMs = 1000) { this.queue = []; this.active = 0; this.maxConcurrent = maxConcurrent; this.delayMs = delayMs; }
async add(apiCall) { while (this.active >= this.maxConcurrent) { await new Promise(resolve => setTimeout(resolve, 100)); }
this.active++;
try { const result = await apiCall(); await new Promise(resolve => setTimeout(resolve, this.delayMs)); return result; } finally { this.active--; } }}
const queue = new APIQueue(5, 1000);const result = await queue.add(() => downloadSubtitles(videoUrl));Troubleshooting Checklist
Section titled “Troubleshooting Checklist”Before contacting support, verify:
- You have an active RapidAPI subscription
- Your API key is correct and properly formatted
- You’re using the correct API host in headers
- The YouTube URL is valid and complete
- The video has captions/subtitles available
- You haven’t exceeded your rate limits
- You’re sending parameters as query parameters in the URL
- Required parameters are properly URL-encoded
Getting Help
Section titled “Getting Help”If you’re stuck, we’re here to help:
Email Support
Section titled “Email Support”What’s Next?
Section titled “What’s Next?”Now that you’re up and running:
- Read the full documentation for your chosen API
- Explore advanced features and options
- Build something awesome!
- Share your project with the community
Ready to dive deeper?
- Subtitles Downloader API Docs
- Summarizer API Docs
- Timestamps Generator API Docs
- Thumbnails Extractor API Docs
Happy coding!