YouTube Shorts Trend Finder Using Python (Find Viral Ideas Early)

Most creators guess what might go viral on YouTube Shorts.

But what if you could see exactly what’s already working – based on real data?

In this guide, you’ll build a simple Python script that extracts trending Shorts, analyzes views, and helps you find viral ideas before they get saturated.

Smart creators?
They analyze what’s already working.

In this guide, you’ll learn how to use the YouTube Data API + Python to extract real data and identify viral trends before they get saturated.


This guide is perfect for:

  • Content creators looking for viral Shorts ideas
  • SEO professionals exploring YouTube data
  • Python beginners building real-world projects

What You’ll Build (YouTube Shorts Trend Finder Tool)

A simple Python script that shows:

  • Trending Shorts titles
  • View counts
  • Upload dates
  • Sorted by popularity

👉 Basically: your own mini trend engine for YouTube Shorts.

Final Output (What You’ll Get)

Screenshot 2026 04 02 at 3.04.33 PM

This is where things get interesting.

In practice, you’ll see a simple table with the top Shorts in your niche, sorted by views, so you can quickly spot recurring hooks and formats


Step 1: Setup YouTube API

Go to Google Cloud Console:

Create a project

Screenshot 2026 04 02 at 2.26.13 PM

Search YouTube Data API v3

Screenshot 2026 04 02 at 2.28.40 PM

Enable YouTube Data API v3

Screenshot 2026 04 02 at 2.28.56 PM

Generate an API key

Screenshot 2026 04 02 at 2.29.41 PM

Select the YouTube API

Screenshot 2026 04 02 at 2.32.28 PM

API is created

Screenshot 2026 04 02 at 2.33.58 PM

Step 2: Test API Connection

Before building the full script, we tested a basic request.

Pro tips before you run it:

  • Replace PASTE_YOUR_API_KEY_HERE with your actual YouTube Data API key from Google Cloud Console.
  • If you get an error, print response.status_code and response.text to see what went wrong (often quota or invalid key).

Test Script

import requests

API_KEY = "PASTE_YOUR_API_KEY_HERE"

url = "https://www.googleapis.com/youtube/v3/search"

params = {
    "part": "snippet",
    "q": "ai shorts",
    "maxResults": 3,
    "key": API_KEY
}

response = requests.get(url, params=params)

print(response.json())
Screenshot 2026 04 02 at 2.46.17 PM

If you see a response like this – your setup is correct.


Step 3: Extract Shorts Data Using Python

Here’s the core script:

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

# Step 1: Search videos
search_url = "https://www.googleapis.com/youtube/v3/search"

params = {
    "part": "snippet",
    "q": "bakery shorts",
    "maxResults": 10,
    "type": "video",
    "order": "viewCount",
    "key": API_KEY
}

response = requests.get(search_url, params=params)
data = response.json()

videos = []

for item in data["items"]:
    video_id = item["id"]["videoId"]
    title = item["snippet"]["title"]
    channel = item["snippet"]["channelTitle"]
    published = item["snippet"]["publishedAt"]

    videos.append([video_id, title, channel, published])

# Step 2: Get views
video_ids = ",".join([v[0] for v in videos])

stats_url = "https://www.googleapis.com/youtube/v3/videos"

stats_params = {
    "part": "statistics",
    "id": video_ids,
    "key": API_KEY
}

stats_response = requests.get(stats_url, params=stats_params)
stats_data = stats_response.json()

for i, item in enumerate(stats_data["items"]):
    views = item["statistics"].get("viewCount", 0)
    videos[i].append(int(views))

# Step 3: Create dataframe
df = pd.DataFrame(videos, columns=["Video ID", "Title", "Channel", "Published", "Views"])

df = df[df["Title"].str.contains("short", case=False)]

# Step 4: Sort
df = df.sort_values(by="Views", ascending=False)

print(df[["Title", "Views", "Published"]].head(10))

Pro tips for making this script more robust:

  • Add a basic safety check before the loop: if “items” not in data or not data[“items”]: print(“No results found”); exit() so the script fails gracefully.
  • YouTube’s videos endpoint accepts up to 50 IDs at a time, so if you later increase maxResults beyond 50, split video_ids into chunks before calling the stats API.
  • If you want Shorts more precisely, keep the “short” filter in the title, but also experiment with very short queries plus order=”viewCount” to surface typical Shorts-style content.
  • Save your results with df.to_csv(“shorts_trends.csv”, index=False) so you can revisit ideas later without re-calling the API.
  • Optional: Add this right after data = response.json() if you want a clearer message when no results are returned.
if "items" not in data or not data["items"]:
    print("No videos found for this query. Try a different keyword.")
    exit()

What the Data Reveals (Real Insights)

Let’s go deeper 👇

Micro-niches dominate

“Jiggly cake cutting” appears multiple times with massive views.

  • 👉 Viral content is not broad
  • 👉 It’s hyper-specific + repeatable

Shorts can be evergreen

Videos from 2022–2023 still getting:

  • 80M+ views
  • 300M+ views

👉 Meaning:
Good concepts don’t die quickly

Titles still matter

Almost every video includes:

  • “#shorts”
  • or “shorts” keyword

👉 Even Shorts rely on basic SEO signals

Visual hooks win

Top videos are not educational.

They are:

  • Cake cutting
  • Satisfying visuals
  • Quick reactions

👉 Lesson:
If it’s not instantly watchable, it won’t scale


How to Find Viral YouTube Shorts Ideas Using This Data

Now that you have the data, here’s how to act on it:

Step 1: Pick a niche

Example:

  • Bakery
  • Fitness
  • AI tools

Step 2: Run the script

Extract top-performing Shorts

Step 3: Identify patterns

Look for:

  • Repeating formats
  • Hooks
  • Visual styles

Step 4: Recreate (don’t copy)

Use the same concept, different execution


Pro Tip

Change this line:

“q”: “bakery shorts”

Try:

  • “fitness shorts”
  • “money shorts”
  • “ai tools shorts”

👉 You now have unlimited content ideas

Most creators:
❌ Guess what might work

You:
✅ Use data to predict what will work

That’s the difference between:

Posting content
vs
Building a system

More pro tips as you tweak the query:

  • Start with one niche keyword + “shorts” (like “fitness shorts”) and only change one part at a time so you can see what actually improves results.
  • Re-run the script every few days for the same niche and compare CSVs to spot formats that keep showing up (this is how you find repeatable formats, not one-hit wonders).
  • Always treat this as inspiration, not copy-paste: borrow hooks, pacing, and visual patterns, but keep the ideas and footage original.

Conclusion

Your support means a lot!

Follow me here on Medium, X, and LinkedIn for more writing on automation, systems, SEO and applied AI.

I share fresh tips every week that can save you time and boost your results.

If you are dealing with brittle automations, slow workflows, or AI projects that never quite stick, feel free to reach out.

Got questions or ideas? Drop a comment – I love hearing from readers and sharing insights.

And don’t forget to share this post with your network if you think it will help them too!

👉 Also read: How to Track Google Rankings in Google Sheets (Free Method)
👉 Next: Instagram Reels Data Extraction Using Python (Coming Soon)

FAQs

How do I find trending YouTube Shorts?

You can use the YouTube Data API with Python to extract videos sorted by views and identify high-performing content.

Is YouTube Shorts data available via API?

Yes, using the YouTube Data API v3, you can fetch video data including titles, views, and publish dates.

Can I use this without coding experience?

Yes. The script is beginner-friendly and requires only basic Python setup.

How do I find viral content ideas consistently?

By analyzing patterns in high-performing Shorts such as titles, formats, and visual hooks.

Shauvik Kumar

SEO • Python • Automation • AI Workflows

Hi, I’m Shauvik - an SEO and ecommerce growth professional who accidentally got into coding while trying to automate repetitive work and solve complex SEO problems.I work across AI workflows, Python automation, programmatic SEO, Google Sheets, analytics, and ecommerce growth. Through FunWithAI.in, I share practical tutorials, experiments, and automations that help marketers, students, and businesses save time and scale faster.Founder of FunWithAI.in and researcher in Technical SEO, GEO and AI Search Optimization.

Leave a Comment