Viral Video Analysis and Replication Guide using Gemini AI - n8n Workflow

Use this powerful n8n workflow to automatically scrape viral Instagram Reels via Apify, analyze the video structure and content using Gemini AI, and save actionable replication guidelines in Airtable. Automate your content strategy with n8n.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content Strategists and Marketers aiming to quickly identify and replicate successful video content.

  • Automation engineers looking for advanced examples of LLM integration with binary data (video files) in an n8n workflow.

  • Social media agencies needing an efficient way to track competitor performance and generate creative briefs.

  • Users who require robust, scheduled data scraping and subsequent AI analysis within an n8n template.

Overview

Analyzing what makes a short-form video viral typically involves tedious manual review. This solution provides a complete end-to-end automation using the power of n8n. It solves the problem of manual performance tracking by automatically initiating a monthly scrape of specified creators, finding the most-viewed Reels, and then using Google’s powerful Gemini model (via httpRequest n8n node) to dissect the video. The output is a comprehensive replication guideline—covering background, pose, text, and context—saved directly into an Airtable database. This complex, two-part n8n workflow ensures you always have fresh, analyzed content ideas, making it one of the most valuable n8n templates for content creation.

How it Works

This advanced automation operates in two distinct scenarios linked by an n8n trigger:

Scenario 1: Discovery and Data Storage (Parent Workflow)


  1. Scheduled Start: The process begins with the Schedule Trigger, set to run monthly.

  2. Fetch Creators: An Airtable Search Creators n8n node retrieves the list of target Instagram accounts.

  3. Scraping: The Loop Over Items n8n node iterates through the creators. An Apify - Fetch Reels httpRequest n8n node uses the Instagram Scraper to pull the latest 20 posts (Reels/Stories) for that creator.

  4. Data Processing: The Save Fields n8n node extracts the video URL, view count, and caption. The data is then filtered by the Sort n8n node (descending views) and the Limit n8n node (keeping the top viral reel).

  5. Airtable Creation: The Create Video Airtable n8n node saves the top reel's metadata and video URL attachment to the 'Videos' table.

  6. Analysis Trigger: The Execute Workflow1 n8n node immediately triggers the second (child) n8n workflow, passing the newly created Airtable record ID for deep AI analysis.

Scenario 2: AI Video Analysis (Child Workflow)


  1. Triggered Start: The When Executed by Another Workflow n8n trigger receives the Airtable record ID.

  2. Data Retrieval: The Get Video Airtable n8n node fetches the attached video file data.

  3. Gemini Upload Preparation: Two httpRequest n8n nodes handle the Gemini API file upload. First, Gemini - Generate Upload URL initiates a resumable upload, providing necessary headers like file size and type.

  4. File Transfer: The Download File n8n node fetches the binary video data, which is then sent via the Gemini - Upload File n8n node to the generated Gemini upload URL.

  5. Wait & Prompt: A Wait n8n node ensures the file is processed. The Set Prompt n8n node defines the detailed analysis request.

  6. AI Query: The Gemini - Ask Questions httpRequest n8n node calls the gemini-1.5-pro model, referencing the uploaded video file URI and the analysis prompt.

  7. Guideline Update: Finally, the Set Guideline Airtable n8n node updates the original Airtable record with the generated replication guidelines, completing the n8n workflow cycle.

Installation Guide

To deploy this powerful n8n template, follow these steps:


  1. Import: Copy the provided n8n workflow JSON data and import it into your n8n instance.

  2. Airtable Setup: Configure credentials for the Airtable n8n nodes. Ensure your Airtable base contains two tables: 'Creators' (listing Instagram usernames) and 'Videos' (with fields for 'Video' attachment, 'Views', 'Caption', 'Creator', and 'Guideline').

  3. External Services: Set up accounts for Apify (for scraping) and obtain Google AI API keys for Gemini.

  4. Credentials & Tokens: Replace the placeholder tokens (tokenhere>) in the following httpRequest n8n nodes:

- Apify - Fetch Reels (API Token)
- Gemini - Generate Upload URL (API Key)
- Gemini - Upload File (API Key)
- Gemini - Ask Questions (API Key)

  1. Child Workflow Linking: Ensure the Execute Workflow1 n8n node points to the ID of the imported analysis workflow (Scenario 2). If you import both scenarios, update the ID accordingly.

  2. Activation: Once all credentials are set, activate the Schedule Trigger to start the automatic discovery process.

Node Details

Schedule Trigger: The primary n8n trigger for Scenario 1, initiating the entire process on a monthly basis.
Search Creators (Airtable n8n node): Retrieves a list of Instagram accounts to monitor from a specified Airtable base.
Apify - Fetch Reels (HTTP Request n8n node): Uses Apify's API to scrape recent content from the listed Instagram users, essential for gathering viral data for this n8n workflow.
Sort / Limit (Core Logic n8n nodes): Filters the scraped data to identify and isolate the single most viewed video (highest view count) from the batch.
Create Video (Airtable n8n node): Creates a database record for the viral video, storing the URL and metadata.
Execute Workflow1 (n8n node): Acts as the bridge, triggering the dedicated analysis n8n workflow (Scenario 2) immediately after a viral video is recorded.
When Executed by Another Workflow (n8n trigger): The starting point of Scenario 2, activated by the parent n8n workflow.
Download File (HTTP Request n8n node): Downloads the actual video file binary data using the URL retrieved from Airtable, preparing it for AI analysis.
Gemini - Generate Upload URL / Gemini - Upload File (HTTP Request n8n nodes): Handles the multi-step resumable file upload process required by the Gemini API, a critical part of integrating video analysis into this n8n workflow.
Set Prompt (Set n8n node): Defines a highly detailed prompt instructing Gemini 1.5 Pro to break down the video into key replication parameters (pose, text, context, etc.).
Gemini - Ask Questions (HTTP Request n8n node): The core AI processing step, sending the analysis prompt and the video file URI to Gemini 1.5 Pro.
Set Guideline (Airtable n8n node): Updates the original Airtable record with the complex text analysis generated by the AI, finalizing the data collection for the n8n workflow.

Related n8n Workflows

Free

Nodes: 11 Nodes
Updated: December 26 2025
View all
Created by

I am a business analyst with a development background, dedicated to helping small businesses and entrepreneurs leverage cloud services for increased efficiency. My expertise lies in automating manual workflows, integrating data from multiple cloud service providers, creating insightful dashboards, and building custom CRM systems.

Featured*