DeployFrame Docs

YouTube Transcript API Setup

Configure YouTube transcript access for video transcription and summarization services

YouTube Transcript API Setup

Your AI SaaS platform includes powerful YouTube video analysis services, including video transcription and summarization. To enable these features, you need to set up access to the YT API (a third-party YouTube transcript API) through RapidAPI. This guide will walk you through subscribing to this API and integrating it with your platform.

How YouTube Services Work

The YouTube-related services in your AI SaaS platform work in two steps:

  1. Transcript Retrieval - The platform uses the third-party YT API from RapidAPI to fetch the transcript text from YouTube videos
  2. Analysis - For summarization, the platform then processes this transcript using OpenAI's models to generate insights

Setting up the YT API is essential as it provides the transcript data that powers both services.

Prerequisites

Before proceeding, ensure you have:

  • Deployed your core infrastructure successfully
  • Completed the OpenAI API setup (required for summarization functionality)

Setting up YT API Access on RapidAPI

Create a RapidAPI Account

  1. Visit RapidAPI's website
  2. Sign up using your email, Google account, GitHub account, or other available options
  3. Complete the registration process

If you already have a RapidAPI account, simply log in and proceed to the next step.

Subscribe to YT API

  1. Go to the YT API page on RapidAPI
  2. Review the API capabilities and pricing tiers
  3. Select the "Basic" subscription plan (free tier with 300 requests per month)
  4. Click "Subscribe" to activate your access

This third-party API provides transcript retrieval functionality for YouTube videos. The Basic plan is sufficient for testing and low-volume usage.

Get Your API Key

  1. After subscribing, navigate to the "Endpoints" tab on the YT API page
  2. Look for the "X-RapidAPI-Key" in the code snippets or on the right side of the page
  3. Copy your API key (it will look like a long alphanumeric string)

Keep your API key secure. Do not share it publicly or commit it to version control.

Add API Key to Environment Variables

  1. Open your .env file in the cdk directory
  2. Add a new variable for the YouTube API key:
# YouTube API (RapidAPI)
YOUTUBE_API_KEY=your-rapidapi-key-here

Replace your-rapidapi-key-here with your actual RapidAPI key.

Redeploy Your Infrastructure

Now that you've added your YouTube API key, redeploy your infrastructure to apply the changes:

cd cdk
cdk deploy --all --require-approval never

This deployment will update your Lambda functions with the YOUTUBE_API_KEY environment variable, enabling the YouTube video transcription and summarization services.

Verifying API Integration

After completing the deployment with your API key, verify that the YouTube-related services are working correctly:

Test YouTube Summarization Service

  1. Navigate to your application URL and sign in to your account
  2. Go to the AI Services section and select "YouTube Video Summarization"
  3. Copy a YouTube video URL (e.g., https://www.youtube.com/watch?v=dQw4w9WgXcQ)
  4. Paste the URL into the input field and click "Summarize"

The system will first retrieve the transcript using the YT API, then process it with OpenAI to generate a summary.

Verify Results

If the integration is successful:

  • You should see a concise summary of the video's content
  • Your credit balance should be reduced according to the service pricing

A successful summary indicates that both the YT API is correctly retrieving transcripts and OpenAI is properly processing this text data.

Understanding API Usage

The YT API from RapidAPI is a third-party service that specifically retrieves transcript data from YouTube videos. It is not an official Google or YouTube product.

The free Basic plan on RapidAPI includes 300 requests per month. Each video transcript retrieval counts as one request. For heavy usage, you may need to upgrade to a paid plan.

The platform's credit system helps manage API usage by:

  • Charging users credits for each service usage
  • Preventing excessive API calls when users have insufficient credits
  • Allowing you to adjust service pricing based on your API subscription costs

Troubleshooting

If you encounter issues with the YouTube services, check the following:

  1. API Key Format: Ensure your RapidAPI key is correctly formatted in the .env file
  2. Subscription Status: Verify that your RapidAPI subscription is active
  3. Usage Limits: Check if you've reached your monthly request limit on RapidAPI
  4. Video Accessibility: Ensure the YouTube video is publicly accessible and has captions available
  5. Lambda Logs: Check CloudWatch logs for any errors in the related Lambda functions

Next Steps

With the YouTube API configured, you now have all the necessary third-party integrations for your AI SaaS platform. You can proceed to Verifying Your Deployment to test all services comprehensively.