An AI-powered tool that analyzes YouTube videos for content patterns, hooks, themes, and engagement strategies. Perfect for content creators who want to understand what makes videos successful in their niche.
- Video Discovery: Search and find top-performing videos in any niche using YouTube Data API
- Transcript Extraction: Automatically pulls full video transcripts
- AI-Powered Analysis: Uses LLMs (OpenAI/Claude) to extract:
- Opening hooks and attention grabbers
- Key themes and topics
- Content structure and flow
- Engagement strategies
- Storytelling techniques
- Batch Processing: Analyze multiple videos at once
- Export Results: Save analysis to JSON, CSV, or markdown reports
- Python 3.9 or higher
- YouTube Data API key
- OpenAI API key or Anthropic API key
- Clone the repository:
git clone https://github.com/gabubu-dev/youtube-content-analyzer.git
cd youtube-content-analyzer- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Configure API keys:
cp config.example.json config.json
# Edit config.json with your API keysCreate a config.json file with your API credentials:
{
"youtube_api_key": "your-youtube-api-key",
"openai_api_key": "your-openai-api-key",
"anthropic_api_key": "your-anthropic-api-key",
"default_llm": "openai",
"model": "gpt-4-turbo-preview",
"max_videos": 10,
"language": "en"
}Analyze top videos in a niche:
python -m src.cli search "content creation tips" --max-results 5 --analyzeAnalyze a specific video:
python -m src.cli analyze https://www.youtube.com/watch?v=VIDEO_IDBatch analyze from a list:
python -m src.cli batch video_urls.txt --output results.jsonfrom src.analyzer import YouTubeAnalyzer
from src.config import load_config
# Initialize
config = load_config("config.json")
analyzer = YouTubeAnalyzer(config)
# Search and analyze
results = analyzer.search_and_analyze("productivity tips", max_results=5)
# Analyze specific video
analysis = analyzer.analyze_video("https://www.youtube.com/watch?v=VIDEO_ID")
# Access analysis results
print(analysis.hooks)
print(analysis.themes)
print(analysis.engagement_strategies)src/
├── __init__.py
├── cli.py # Command line interface
├── config.py # Configuration management
├── youtube_client.py # YouTube API wrapper
├── transcript.py # Transcript extraction
├── llm_client.py # LLM API clients (OpenAI/Claude)
├── analyzer.py # Main analysis orchestration
├── prompts.py # Analysis prompt templates
└── export.py # Export functionality
tests/
├── test_youtube_client.py
├── test_transcript.py
├── test_analyzer.py
└── test_export.py
pytest tests/This project follows PEP 8 style guidelines. Format code with:
black src/ tests/Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes with clear commit messages
- Add tests for new functionality
- Submit a pull request
MIT License - see LICENSE file for details
- Built with YouTube Data API v3
- Uses youtube-transcript-api for transcript extraction
- Powered by OpenAI and Anthropic LLMs