DEV Community

Cover image for Find Which YouTube Titles Earn Free Views: Rank Your Videos by Views per Day With Python
SEO - NT Tech Innovation
SEO - NT Tech Innovation

Posted on

Find Which YouTube Titles Earn Free Views: Rank Your Videos by Views per Day With Python

By MD Fozla Rabbi, SEO Specialist

Here's a small problem I kept running into while helping Indian creators. They'd ask, "How do I get more YouTube views for free?" And I'd ask back, "Which of your videos already gets free views?" Most had no idea. They looked at the total count and moved on.

So I wrote a tiny Python script. It pulls every video's stats from a channel using the YouTube Data API, then ranks them by views per day since publish. That one number tells you which titles and topics YouTube is already pushing for free. Then you make more of those.

Let's build it.

What you need

  • Python 3.9+
  • A Google Cloud project with YouTube Data API v3 enabled
  • An API key (read-only public data is fine, no OAuth needed)
  • The requests library
pip install requests
Enter fullscreen mode Exit fullscreen mode

Keep your API key in an environment variable. Don't paste it into code you share.

export YT_API_KEY="your-key-here"
Enter fullscreen mode Exit fullscreen mode

Step 1: Find the channel's uploads playlist

Every channel has a hidden "uploads" playlist. That's the easiest way to list all videos.

import os
import requests

API = "https://www.googleapis.com/youtube/v3"
KEY = os.environ["YT_API_KEY"]

def uploads_playlist(channel_id):
    r = requests.get(f"{API}/channels", params={
        "part": "contentDetails",
        "id": channel_id,
        "key": KEY,
    })
    r.raise_for_status()
    items = r.json()["items"]
    return items[0]["contentDetails"]["relatedPlaylists"]["uploads"]
Enter fullscreen mode Exit fullscreen mode

Step 2: List every video ID

The playlist endpoint returns 50 at a time, so we page through it.

def video_ids(playlist_id):
    ids, token = [], None
    while True:
        params = {
            "part": "contentDetails",
            "playlistId": playlist_id,
            "maxResults": 50,
            "key": KEY,
        }
        if token:
            params["pageToken"] = token
        r = requests.get(f"{API}/playlistItems", params=params)
        r.raise_for_status()
        data = r.json()
        ids += [i["contentDetails"]["videoId"] for i in data["items"]]
        token = data.get("nextPageToken")
        if not token:
            return ids
Enter fullscreen mode Exit fullscreen mode

Step 3: Pull stats in batches of 50

def video_stats(ids):
    rows = []
    for i in range(0, len(ids), 50):
        r = requests.get(f"{API}/videos", params={
            "part": "snippet,statistics",
            "id": ",".join(ids[i:i + 50]),
            "key": KEY,
        })
        r.raise_for_status()
        for v in r.json()["items"]:
            s = v["statistics"]
            rows.append({
                "title": v["snippet"]["title"],
                "published": v["snippet"]["publishedAt"],
                "views": int(s.get("viewCount", 0)),
                "likes": int(s.get("likeCount", 0)),
                "comments": int(s.get("commentCount", 0)),
            })
    return rows
Enter fullscreen mode Exit fullscreen mode

Step 4: Rank by views per day

Total views reward old videos. Views per day shows what's working now.

from datetime import datetime, timezone

def rank(rows):
    now = datetime.now(timezone.utc)
    for r in rows:
        pub = datetime.fromisoformat(r["published"].replace("Z", "+00:00"))
        days = max((now - pub).days, 1)
        r["views_per_day"] = round(r["views"] / days, 1)
        r["like_rate"] = round(100 * r["likes"] / r["views"], 2) if r["views"] else 0
    return sorted(rows, key=lambda r: r["views_per_day"], reverse=True)

if __name__ == "__main__":
    import sys
    pl = uploads_playlist(sys.argv[1])
    ranked = rank(video_stats(video_ids(pl)))
    for r in ranked[:10]:
        print(f'{r["views_per_day"]:>8} /day  {r["like_rate"]:>5}%  {r["title"][:60]}')
Enter fullscreen mode Exit fullscreen mode

Run it with a channel ID:

python yt_rank.py UCxxxxxxxxxxxxxxxxxxxxxx
Enter fullscreen mode Exit fullscreen mode

How to read the output

Look at your top 5 by views per day. Ask:

  • Same topic? If three of five are "budget phone reviews," that's your lane.
  • Same title pattern? Questions? Numbers? Hindi + English mix?
  • Shorts or long videos? Shorts often spike views per day but watch time matters for monetization.
  • Like rate above 4%? That usually means the audience is genuinely into it.

Then do the obvious thing. Make three more videos in that pattern. That's genuinely the cheapest "free views" strategy I know. Your own data already picked the winner.

Quota note

The API gives you a daily quota. This script uses very little: a few units per 50 videos. A channel with 500 videos costs maybe 25 units. You won't hit limits running it once a day.

Going further

If you want the non-code side of this, the SMMYodha team wrote a practical guide on how to get views on YouTube for free. It covers titles, thumbnails, Shorts and posting times for Indian creators. Pair it with the script and you'll know what to change and whether it worked.

For channels that need a small push on a video that already performs well, SMMYodha also offers YouTube views and watch-time services priced in rupees.

Full script

Everything above fits in one file of about 80 lines. Copy the four functions, add the main block and you're done. Run it every Sunday. Watch which titles climb. Make more of them.

That's it. Small script, honest numbers, better decisions.

Top comments (0)