Skip to content

rajit2004/yt-analytics-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📊 YouTube Analytics Tracker

Automatically tracks daily YouTube channel stats — subscribers, views, Longs vs Shorts performance — and generates charts and Excel reports using the YouTube Data API v3.

Python YouTube API GitHub Sponsors


📸 Sample Output

Subscribers Growth
Longs vs Shorts Views
Daily View Deltas
Analytics Report (Excel)
Generated in outputs/analytics_report.xlsx

✨ Features

  • 📅 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

🛠️ Tech Stack

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

⚡ Setup & Usage

1. Clone the repo

git clone https://github.com/rajit2004/yt-analytics-tracker.git
cd yt-analytics-tracker

2. Install dependencies

pip install -r requirements.txt

3. Set up your API key

cp .env.example .env

Then 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

4. Run the tracker

# Simple version (uses requests)
python stats_data.py

# Modular version (uses Google API client)
python auto_data_feed.py

📁 Project Structure

yt-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

🔄 Automate Daily Runs

To run this automatically every day, set up a cron job (Linux/Mac):

0 9 * * * cd /path/to/yt-analytics-tracker && python stats_data.py

Or use Windows Task Scheduler to run stats_data.py daily.


💖 Support

If this project helped you, consider supporting my work:

Sponsor


👨‍💻 Author

Ranesh Rajit — B.Tech CS Student, India

GitHub

About

Tracks daily YouTube channel stats (subscribers, views, Longs vs Shorts) using YouTube Data API v3 — auto-generates Excel reports and charts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages