A comprehensive, modular Python application for analyzing YouTube Studio data with interactive visualizations, machine learning predictions, and automated reporting.
- ๐ Interactive Dashboards: Web-based dashboards using Streamlit and Dash
- ๐ Time Series Analysis: Views, likes, and comments trends over time
- ๐ฏ Engagement Analytics: Like rates, comment rates, and engagement patterns
- ๐ฅ Subscriber Insights: Growth and decline analysis with detailed metrics
- ๐ค ML Predictions: Machine learning models to predict video performance
- ๐ Export Reports: Automated Excel, JSON, and HTML report generation
- ๐ฅ Correlation Analysis: Performance correlation heatmaps
- ๐ฑ Responsive Design: Works on desktop and mobile devices
- ๐๏ธ Modular Architecture: Professional code structure for maintainability
YouTubeStudioDataAnalytics/
โโโ ๐ฏ main.py # Main entry point with CLI
โโโ ๏ฟฝ src/ # Source code modules
โ โโโ ๐ analytics/ # Core analytics package
โ โ โโโ __init__.py # Package initialization
โ โ โโโ core.py # Main YouTubeAnalytics class
โ โ โโโ data_loader.py # Data loading and preprocessing
โ โ โโโ visualizations.py # Chart generation with Plotly
โ โ โโโ ml_predictor.py # Machine learning models
โ โโโ ๐ dashboards/ # Dashboard implementations
โ โ โโโ __init__.py # Dashboard package init
โ โ โโโ streamlit_app.py # Streamlit dashboard
โ โ โโโ dash_app.py # Dash dashboard
โ โโโ ๏ฟฝ๏ธ utils/ # Utility modules
โ โโโ __init__.py # Utils package init
โ โโโ config.py # Configuration management
โ โโโ data_utils.py # Data validation & statistics
โ โโโ export_utils.py # Export and reporting utilities
โโโ ๐ data/ # Data directory
โ โโโ sample/ # Sample data files
โ โ โโโ videos.csv # Sample video data
โ โ โโโ subscribers.csv # Sample subscriber data
โ โโโ exports/ # Generated reports and charts
โโโ โ๏ธ config/ # Configuration files
โ โโโ config.json # Default configuration
โโโ ๐งช tests/ # Test suite
โ โโโ __init__.py # Test package init
โ โโโ test_imports.py # Import tests
โโโ ๐ notebooks/ # Jupyter notebooks
โโโ ๐ docs/ # Documentation
โโโ ๐ฆ requirements.txt # Python dependencies
โโโ ๐ README.md # This file
# Clone the repository
git clone https://github.com/DuongCaoNhan/YouTubeStudioDataAnalytics.git
cd YouTubeStudioDataAnalytics
# Install dependencies
pip install -r requirements.txt
# Or install individually
pip install pandas plotly streamlit dash scikit-learn openpyxl jupyter- Go to YouTube Studio โ Analytics
- Click "Export Report" tab
- Select date range and metrics
- Export as CSV files:
videos.csv: Video performance datasubscribers.csv: Subscriber activity data
videos.csv:
Title, Publish Date, Views, Likes, Comments, Duration (minutes)
subscribers.csv:
Date, Subscribers Gained, Subscribers Lost, Net Subscribers
# Run complete analytics pipeline
python main.py --analysis
# Start interactive Streamlit dashboard
python main.py --streamlit
# Start professional Dash dashboard
python main.py --dash
# Quick data analysis only
python main.py --data-only
# ML prediction demonstration
python main.py --ml-demo
# Interactive mode (default)
python main.pyfrom src.analytics import YouTubeAnalytics
# Initialize with your data
analytics = YouTubeAnalytics(
videos_file="data/sample/videos.csv",
subscribers_file="data/sample/subscribers.csv"
)
# Run complete analysis
results = analytics.run_complete_analysis()
# Generate specific visualizations
charts = analytics.create_all_visualizations()
# Train ML models
ml_results = analytics.train_prediction_model()
# Export results
analytics.export_results("output/")After running analysis, you'll find:
data/exports/
โโโ ๐ youtube_analytics_report.xlsx # Excel report with multiple sheets
โโโ ๐ charts/ # Interactive HTML charts
โ โโโ views_timeline.html
โ โโโ engagement_comparison.html
โ โโโ correlation_heatmap.html
โ โโโ ... (10 chart files)
โโโ ๐ค ml_model.joblib # Trained ML model
โโโ ๐ analysis_results.json # Complete results in JSON
โโโ ๐ processed_videos.csv # Processed video data
โโโ ๐ processed_subscribers.csv # Processed subscriber data
Customize behavior via config/config.json:
{
"ml": {
"default_model_type": "linear",
"hyperparameter_tuning": true
},
"visualization": {
"default_theme": "plotly_white",
"color_palette": ["#1f77b4", "#ff7f0e", "..."]
}
}Features:
- Complete analytics pipeline
- Interactive Plotly charts
- Summary statistics
- ML predictions
- Excel report export
streamlit run streamlit_dashboard.pyThen open: http://localhost:8501
Features:
- Real-time interactive dashboard
- Multi-page navigation
- Date range filtering
- Live data updates
- Mobile-responsive design
python dash_dashboard.pyThen open: http://localhost:8050
Features:
- Professional dashboard interface
- Advanced interactivity
- Custom styling
- Real-time updates
jupyter notebook youtube_analytics_notebook.ipynbFeatures:
- Step-by-step analysis
- Detailed explanations
- Interactive exploration
- Customizable analysis
- Views Analysis: Track view patterns over time
- Engagement Rates: Like rate and comment rate calculations
- Performance Comparison: Compare videos side-by-side
- Top Performers: Identify your best-performing content
- Growth Tracking: Monitor subscriber gains and losses
- Activity Patterns: Analyze subscriber behavior over time
- Net Growth: Calculate overall subscriber growth trends
- View Prediction: Predict views for new videos
- Feature Importance: Understand what drives performance
- Model Accuracy: Rยฒ scores and performance metrics
- Interactive Predictor: Test different video parameters
- Line Charts: Time series trends
- Bar Charts: Performance comparisons
- Scatter Plots: Correlation analysis
- Heatmaps: Performance correlation matrices
- Histograms: Distribution analysis
- Bubble Charts: Multi-dimensional analysis
- Which video topics perform best
- Optimal video length for your audience
- Best publishing times and patterns
- Engagement rate benchmarks
- Content types that drive most engagement
- Correlation between video length and performance
- Subscriber impact of different content types
- Seasonal performance patterns
- Expected performance for new videos
- Feature importance for video success
- Performance confidence intervals
- Optimization recommendations
Edit config.ini to customize:
[data_files]
videos_file = your_videos.csv
subscribers_file = your_subscribers.csv
[dashboard]
streamlit_port = 8501
dash_port = 8050
[visualization]
youtube_red = #FF0000
chart_height = 500- Comprehensive analytics data
- Summary statistics
- Top performers lists
- Subscriber activity data
- Executive summary
- Key visualizations
- Performance insights
- Recommendations
Test how different parameters affect predicted views:
- Video duration
- Expected engagement rates
- Content type factors
- Engagement Rate = (Likes + Comments) / Views ร 100
- Like Rate = Likes / Views ร 100
- Comment Rate = Comments / Views ร 100
- Performance Score = Combined weighted metrics
- Identify relationships between metrics
- Understand performance drivers
- Optimize content strategy
1. Import Errors
pip install --upgrade -r requirements.txt2. Data Loading Issues
- Check CSV file format and column names
- Ensure dates are in YYYY-MM-DD format
- Verify file paths in config.ini
3. Dashboard Not Loading
- Check if ports 8501/8050 are available
- Try different ports in config.ini
- Restart the dashboard application
4. Chart Display Issues
- Update your browser
- Clear browser cache
- Check Plotly version:
pip install --upgrade plotly
- pandas: Data manipulation and analysis
- plotly: Interactive visualizations
- numpy: Numerical computations
- scikit-learn: Machine learning models
- streamlit: Web dashboard framework
- dash: Professional dashboard framework
- openpyxl: Excel file generation
- reportlab: PDF report generation
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: Report bugs or request features on GitHub
- Documentation: Check the wiki for detailed guides
- Community: Join discussions in the Issues section
- Real-time API Integration with YouTube Data API
- Advanced ML Models (Random Forest, Neural Networks)
- Automated Insights with AI-generated recommendations
- Team Collaboration features for multiple users
- Mobile App for on-the-go analytics
- Custom Alerts for performance thresholds
- A/B Testing Tools for content optimization
- Competitive Analysis features
- GitHub: @DuongCaoNhan
- Email: [email protected]
- LinkedIn: Duong Cao Nhan
โญ Star this repository if you find it helpful!
๐ Happy analyzing your YouTube data! ๐บโจ