Skip to content

A application to analyze YouTube data from YouTube Studio reports, including: - Analyzing views, likes, and comments over time. - Calculating and visualizing subscriber growth or decline. - Creating interactive visualizations (line chart, bar chart, heatmap) to display data clearly and attractively.

Notifications You must be signed in to change notification settings

DuongCaoNhan/YouTubeStudioDataAnalytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“บ YouTube Studio Data Analytics - Modular Edition

A comprehensive, modular Python application for analyzing YouTube Studio data with interactive visualizations, machine learning predictions, and automated reporting.

๐Ÿš€ Features

  • ๐Ÿ“Š 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

๐Ÿ“‹ Project Structure

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

๐Ÿ› ๏ธ Quick Setup

Installation

# 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

๐Ÿ“Š Getting Your YouTube Data

From YouTube Studio:

  1. Go to YouTube Studio โ†’ Analytics
  2. Click "Export Report" tab
  3. Select date range and metrics
  4. Export as CSV files:
    • videos.csv: Video performance data
    • subscribers.csv: Subscriber activity data

Required CSV Columns:

videos.csv:

Title, Publish Date, Views, Likes, Comments, Duration (minutes)

subscribers.csv:

Date, Subscribers Gained, Subscribers Lost, Net Subscribers

๐Ÿš€ Usage Options

1. ๐ŸŽฏ Command Line Interface (NEW!)

# 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.py

2. ๐Ÿ“Š Programmatic Usage

from 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/")

4. ๐Ÿ“ Generated Outputs

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

5. ๐Ÿ”ง Configuration

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

2. ๐ŸŒ Streamlit Web Dashboard

streamlit run streamlit_dashboard.py

Then open: http://localhost:8501

Features:

  • Real-time interactive dashboard
  • Multi-page navigation
  • Date range filtering
  • Live data updates
  • Mobile-responsive design

3. ๐ŸŒ Dash Web Dashboard

python dash_dashboard.py

Then open: http://localhost:8050

Features:

  • Professional dashboard interface
  • Advanced interactivity
  • Custom styling
  • Real-time updates

4. ๐Ÿ““ Jupyter Notebook Analysis

jupyter notebook youtube_analytics_notebook.ipynb

Features:

  • Step-by-step analysis
  • Detailed explanations
  • Interactive exploration
  • Customizable analysis

๐Ÿ“ˆ Key Analytics Features

๐Ÿ“Š Video Performance Metrics

  • 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

๐Ÿ‘ฅ Subscriber Analytics

  • Growth Tracking: Monitor subscriber gains and losses
  • Activity Patterns: Analyze subscriber behavior over time
  • Net Growth: Calculate overall subscriber growth trends

๐Ÿค– Machine Learning Predictions

  • 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

๐Ÿ“Š Visualization Types

  • 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

๐ŸŽฏ Sample Insights You'll Get

๐Ÿ“ˆ Performance Insights

  • Which video topics perform best
  • Optimal video length for your audience
  • Best publishing times and patterns
  • Engagement rate benchmarks

๐ŸŽฌ Content Strategy

  • Content types that drive most engagement
  • Correlation between video length and performance
  • Subscriber impact of different content types
  • Seasonal performance patterns

๐Ÿ“Š Predictive Analytics

  • Expected performance for new videos
  • Feature importance for video success
  • Performance confidence intervals
  • Optimization recommendations

โš™๏ธ Configuration

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

๐Ÿ“ Export Options

Excel Reports

  • Comprehensive analytics data
  • Summary statistics
  • Top performers lists
  • Subscriber activity data

PDF Reports (Coming Soon)

  • Executive summary
  • Key visualizations
  • Performance insights
  • Recommendations

๐Ÿ”ง Advanced Features

๐ŸŽฎ Interactive Prediction Tool

Test how different parameters affect predicted views:

  • Video duration
  • Expected engagement rates
  • Content type factors

๐Ÿ“Š Custom Metrics

  • Engagement Rate = (Likes + Comments) / Views ร— 100
  • Like Rate = Likes / Views ร— 100
  • Comment Rate = Comments / Views ร— 100
  • Performance Score = Combined weighted metrics

๐Ÿ” Correlation Analysis

  • Identify relationships between metrics
  • Understand performance drivers
  • Optimize content strategy

๐Ÿ› ๏ธ Troubleshooting

Common Issues:

1. Import Errors

pip install --upgrade -r requirements.txt

2. 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

๐Ÿ“š Dependencies

Core Libraries:

  • pandas: Data manipulation and analysis
  • plotly: Interactive visualizations
  • numpy: Numerical computations
  • scikit-learn: Machine learning models

Dashboard Libraries:

  • streamlit: Web dashboard framework
  • dash: Professional dashboard framework

Export Libraries:

  • openpyxl: Excel file generation
  • reportlab: PDF report generation

๐Ÿค Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

  • Issues: Report bugs or request features on GitHub
  • Documentation: Check the wiki for detailed guides
  • Community: Join discussions in the Issues section

๐Ÿ”ฎ Roadmap

Upcoming Features:

  • 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

๐Ÿ“ž Contact


โญ Star this repository if you find it helpful!

๐Ÿš€ Happy analyzing your YouTube data! ๐Ÿ“บโœจ

About

A application to analyze YouTube data from YouTube Studio reports, including: - Analyzing views, likes, and comments over time. - Calculating and visualizing subscriber growth or decline. - Creating interactive visualizations (line chart, bar chart, heatmap) to display data clearly and attractively.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages