LinggarM/Youtube-Subtitle-Downloader
A full-stack Flask application that extracts subtitles from YouTube videos and generates key points using AI models.
YouTube Subtitle Extractor
A full-stack Flask application that extracts subtitles from YouTube videos and generates key points using AI models.
Preview
Features
- ๐ฌ Extract subtitles from any YouTube video with available transcripts
- ๐ Language Selection: Choose from available subtitle languages with detailed information
- ๐ Language Detection: Automatically detect all available subtitle languages
- ๐ท๏ธ Language Info: Shows auto-generated vs manual subtitles and translatability
- ๐ง AI-Powered Key Points: Generate key insights using Groq API with multiple AI models
- ๐จ Modern, responsive web interface with glassmorphism design
- ๐ Copy transcript and key points to clipboard
- ๐ Real-time loading indicators with smooth animations
- ๐ฑ Fully responsive design for all devices
- ๐ RESTful API endpoints
AI Models Available
- Llama 4 Scout 17B: Faster processing for quick key point generation
- Llama 3.3 70B: More accurate analysis for detailed insights
Setup Instructions
1. Install Dependencies
pip install -r requirements.txtOr install manually:
pip install Flask youtube-transcript-api python-dotenv requests2. Environment Setup
Create a .env file in the project root:
GROQ_API_KEY=your_groq_api_key_hereGet your Groq API key from: https://console.groq.com/
3. Project Structure
Create the following directory structure:
youtube-subtitle-extractor/
โโโ app.py
โโโ requirements.txt
โโโ .env
โโโ templates/
โ โโโ index.html
โโโ static/ (auto-created)
4. Run the Application
python app.pyThe application will be available at: http://localhost:5000
Usage
Web Interface
- Open your browser and go to
http://localhost:5000 - Enter a YouTube URL in the input field
- Click "Check Languages" to see available subtitle languages
- Select your preferred language from the grid of options
- Click "Extract Subtitles" to get the transcript
- Choose an AI model and click "Generate Key Points" for AI-powered insights
- Copy transcript or key points to clipboard as needed
API Endpoints
Get Available Languages
POST /api/languages
Request body:
{
"url": "https://www.youtube.com/watch?v=VIDEO_ID"
}Response:
{
"video_id": "VIDEO_ID",
"languages": [
{
"language_code": "en",
"language": "English",
"is_generated": true,
"is_translatable": true
}
],
"success": true
}Extract Transcript
POST /api/transcript
Request body:
{
"url": "https://www.youtube.com/watch?v=VIDEO_ID",
"language_code": "en"
}Response:
{
"video_id": "VIDEO_ID",
"transcript": "Full transcript text...",
"language_code": "en",
"success": true
}Generate Key Points
POST /api/keypoints
Request body:
{
"transcript": "Full transcript text...",
"model": "meta-llama/llama-4-scout-17b-16e-instruct"
}Response:
{
"key_points": "Generated key points...",
"model": "meta-llama/llama-4-scout-17b-16e-instruct",
"success": true
}Health Check
GET /api/health
Response:
{
"status": "healthy"
}Supported URL Formats
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://www.youtube.com/embed/VIDEO_IDhttps://www.youtube.com/watch?v=VIDEO_ID&other_params
Language Selection Features
- Visual Language Grid: Interactive grid showing all available languages
- Language Metadata:
- Auto-generated vs manual subtitles
- Translatable indicators
- Language codes and full names
- Smart Selection: Radio button selection with visual feedback
- Fallback Support: Automatic fallback to default language if selected language fails
AI-Powered Key Points
The application integrates with Groq API to generate intelligent key points:
- Multiple Models: Choose between speed (Llama 4 Scout) and accuracy (Llama 3.3 70B)
- Formatted Output: AI-generated points are formatted with proper HTML rendering
- Indonesian Support: Prompts in Indonesian for localized key point generation
- Error Handling: Robust error handling for API failures
UI/UX Features
- Glassmorphism Design: Modern glass-like aesthetic with backdrop blur
- Smooth Animations: Loading spinners, hover effects, and transitions
- Interactive Elements: Copy buttons with success/error notifications
- SweetAlert2 Integration: Beautiful toast notifications for user feedback
- Responsive Layout: Works seamlessly on desktop, tablet, and mobile
- Color-Coded Sections: Different color schemes for transcript vs key points
Error Handling
Comprehensive error handling for:
- Invalid YouTube URLs
- Videos without available transcripts
- Selected language not available
- Private or restricted videos
- Network errors
- Groq API failures
- Malformed requests
- Invalid AI model selection
Requirements
Python Dependencies
Flask>=2.0.0
youtube-transcript-api>=0.5.0
python-dotenv>=0.19.0
requests>=2.28.0
External Services
- Groq API: For AI-powered key point generation
- YouTube: For video transcript extraction
Notes
- Only works with videos that have available transcripts/subtitles
- Supports both manual and auto-generated subtitles
- AI key point generation requires valid Groq API key
- Indonesian language prompts are used for key point generation
- The transcript is returned as plain text without timestamps
- Key points are formatted with HTML for better presentation
- All data is processed in-memory (no persistent storage)
Contributing
Feel free to submit issues and enhancement requests!
License
This project is open source and available under the MIT License.
