DEV Community

Charbel Daccache
Charbel Daccache

Posted on AI-assisted

Study the hooks of viral Instagram Reels with Python (transcripts + timestamps)

Everyone says "the first three seconds decide a Reel". You can check that against real data instead of guessing: pull the transcripts of a creator's best-performing Reels, cut out what's said in the first few seconds, and compare.

Disclosure: I built the Instagram Transcript Scraper used in this post.

1. Get the transcripts of a creator's viral Reels

Instagram has no caption files, so the transcript comes from speech-to-text. The Instagram Transcript Scraper on Apify does the download and the Whisper step, and minViews drops the small Reels before anything is transcribed.

pip install apify-client
Enter fullscreen mode Exit fullscreen mode
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("scrape-lads/instagram-transcript-scraper").call(run_input={
    "profiles": ["https://www.instagram.com/natgeo/"],
    "maxVideosPerProfile": 12,
    "minViews": 100000,
    "includeSegments": True,
})
reels = [r for r in client.dataset(run["defaultDatasetId"]).iterate_items() if r["status"] == "success"]
Enter fullscreen mode Exit fullscreen mode

Each row has the full transcript, timestamped segments (start, end, text in seconds), durationSec, wordCount and the Reel's stats.

2. Cut out the hook

HOOK_SECONDS = 3

for r in reels:
    hook = " ".join(s["text"] for s in r["segments"] if s["start"] < HOOK_SECONDS)
    duration = float(r["durationSec"] or 0)
    pace = r["wordCount"] / duration if duration else 0
    print(f'{r["stats"]["views"]:>9,} views | {pace:.1f} words/s | {hook[:80]}')
Enter fullscreen mode Exit fullscreen mode

Words per second is a quick way to separate talking-head Reels from visual-first ones.

When I ran this on @natgeo, 11 of its newest Reels had 100,000+ views. One was music only (no speech, so not charged), and among the other 10 the pace ranged from under 1 word per second to about 3. A low number usually means the video carries the Reel and the voice-over is sparse, so on a visual account like this the hook is often not spoken at all. Worth knowing before you copy a format.

3. Let an LLM label the hooks

With a few dozen hooks, labeling them by hand gets old. Build one prompt and send it to whichever model you use:

lines = [f'- ({r["stats"]["views"]:,} views) {" ".join(s["text"] for s in r["segments"] if s["start"] < 3)}'
         for r in reels]
prompt = (
    "Label each Reel hook as one of: question, bold claim, story opener, "
    "visual-only (no real spoken hook), instruction. Then say which label "
    "goes with the most views.\n\n" + "\n".join(lines)
)
print(prompt)  # paste into your LLM, or call its API here
Enter fullscreen mode Exit fullscreen mode

Run it on 3 or 4 creators in your niche and you have an evidence-based hook list instead of a guess.

Notes

  • Logged-out visitors see a profile's 12 newest posts at most. For older Reels, pass Reel URLs in urls instead of profiles.
  • Pass language (for example "es") if you already know the spoken language, or leave it empty for auto-detection.
  • You pay per transcript, and Reels with no speech are free. maxAiMinutes caps how much audio a run can transcribe.

Top comments (0)