Automatically tracks daily YouTube channel stats — subscribers, views, Longs vs Shorts performance — and generates charts and Excel reports using the YouTube Data API v3.
| Subscribers Growth |
Longs vs Shorts Views |
| Daily View Deltas |
Analytics Report (Excel) Generated in outputs/analytics_report.xlsx |
- 📅 Daily data logging — tracks subscribers and video views every day
- 🎥 Longs vs Shorts classification — automatically separates videos by duration (>150s = Long)
- 📈 3 auto-generated charts — subs growth, views over time, daily view deltas
- 📄 Excel analytics report — full data + top performing videos by type
- 🔒 Secure — API key stored in
.env, never committed to git
| Tool | Purpose |
|---|---|
| Python | Core scripting |
| YouTube Data API v3 | Fetching channel & video stats |
| Pandas | Data processing & Excel I/O |
| Matplotlib | Chart generation |
| OpenPyXL | Excel report writing |
| python-dotenv | Secure API key management |
git clone https://github.com/rajit2004/yt-analytics-tracker.git
cd yt-analytics-trackerpip install -r requirements.txtcp .env.example .envThen open .env and fill in your credentials:
YT_API_KEY=your_youtube_api_key_here
YT_CHANNEL_ID=your_channel_id_here
🔑 Get your API key from Google Cloud Console → Enable YouTube Data API v3
# Simple version (uses requests)
python stats_data.py
# Modular version (uses Google API client)
python auto_data_feed.pyyt-analytics-tracker/
├── stats_data.py # Main tracker script
├── auto_data_feed.py # Modular API client version
├── .env # Your API key (never committed)
├── .env.example # Template for setup
├── .gitignore
├── requirements.txt
└── outputs/ # Generated files
├── analytics_report.xlsx
├── subs_growth.png
├── total_views.png
└── daily_deltas.png
To run this automatically every day, set up a cron job (Linux/Mac):
0 9 * * * cd /path/to/yt-analytics-tracker && python stats_data.pyOr use Windows Task Scheduler to run stats_data.py daily.
If this project helped you, consider supporting my work:
Ranesh Rajit — B.Tech CS Student, India