DEV Community

SEO - NT Tech Innovation
SEO - NT Tech Innovation

Posted on

Tracking Progress to 4,000 YouTube Watch Hours with a Tiny Python Script

Indian creators chasing YouTube monetization usually check Studio, see a number and feel either hope or panic. What they rarely do is track the rate. Are you on pace? When will you cross 4,000 hours at your current speed?

So here's a small script that answers exactly that. Export your watch time, run it, get a date.

Get the data

In YouTube Studio go to Analytics → Advanced mode, set the range to the last 365 days, pick Watch time (hours) by day and export as CSV. You'll get a file with a Date column and a Watch time (hours) column.

The script

import csv
from datetime import date, timedelta

TARGET = 4000

def load(path):
    rows = []
    with open(path, newline="", encoding="utf-8") as f:
        for r in csv.DictReader(f):
            try:
                d = date.fromisoformat(r["Date"])
                h = float(r["Watch time (hours)"])
                rows.append((d, h))
            except (KeyError, ValueError):
                continue  # skip totals row and blanks
    return sorted(rows)

def forecast(rows, window=28):
    total = sum(h for _, h in rows)                 # rolling 365-day total
    recent = rows[-window:]
    daily = sum(h for _, h in recent) / max(len(recent), 1)
    gap = max(0, TARGET - total)
    days = gap / daily if daily else float("inf")
    return total, daily, gap, days

rows = load("watch_time.csv")
total, daily, gap, days = forecast(rows)
print(f"Last 365 days: {total:,.0f} h")
print(f"Recent pace:   {daily:.1f} h/day")
if gap == 0:
    print("You're over 4,000. Check the other requirements.")
elif days == float("inf"):
    print("No recent watch time. Pace is zero.")
else:
    print(f"Gap: {gap:,.0f} h -> about {days:.0f} days (~{date.today() + timedelta(days=days)})")
Enter fullscreen mode Exit fullscreen mode

One catch the script can't see

Watch hours are a rolling 12-month window. Old hours fall off every day. If you had a big month a year ago, your total can drop even while you upload. Run this weekly, not once.

Also, Shorts views count toward the separate Shorts route, not these 4,000 public watch hours. Don't let a Shorts spike fool you.

Before you apply

Hitting the number isn't the whole story. There are subscriber, policy and originality checks too, and they've been changing. This summary of YouTube monetization rules in India lists the current checklist, and this guide on how Indian creators reach 4,000 watch hours covers the content side, both from SMMYodha.

Track the pace. Then fix the pace.

Top comments (0)