πŸ“Š Analyze YouTube videos with GPT-4o-mini and get relevance-ranked insights

⚑ 53 views Β· πŸ“Š Market Research & Insights

πŸ’‘ Pro Tip β€” YouTube’s API quotas can be a bottleneck when you’re pulling data at scale. ScraperNode is a community node with dedicated scrapers for channels, videos, and comments β€” no quota limits, just structured data.

View All Scrapers

Description

Description

Submit up to 3 YouTube video URLs using a simple form and the workflow handles everything automatically. It fetches each video’s title, channel, views, and duration from YouTube, submits each video to WayinVideo for accurate speaker-labeled transcription, then sends the transcript to GPT-4o-mini for a 6-field analysis tailored to your niche. Every video is logged to Google Sheets and a single Gmail report arrives sorted by relevance score when all videos are processed. Built for content marketers, SEO strategists, and research teams who want structured intelligence from YouTube videos β€” not just auto-captions.


What This Workflow Does


Setup Requirements

Tools Needed

Credentials Required

Estimated Setup Time: 15–20 minutes


Step-by-Step Setup

  1. Import the workflow β€” Open n8n β†’ Workflows β†’ Import from JSON β†’ paste the workflow JSON β†’ click Import

  2. Get your YouTube Data API key β€” Go to console.cloud.google.com β†’ create or open a project β†’ enable the YouTube Data API v3 β†’ go to Credentials β†’ Create API Key β†’ copy the key

  3. Get your WayinVideo API key β€” Log in to your WayinVideo account β†’ go to Account Settings β†’ copy your API key

  4. Fill in Config Values β€” Open node 2. Set β€” Config Values β†’ replace all placeholders:

FieldWhat to enter
PASTE_YOUR_YOUTUBE_DATA_API_KEY_HEREYour YouTube Data API key from step 2
PASTE_YOUR_WAYINVIDEO_API_KEY_HEREYour WayinVideo API key from step 3
PASTE_YOUR_GOOGLE_SHEET_ID_HEREThe ID from your Google Sheet URL (the string between /d/ and /edit)
PASTE_YOUR_EMAIL_HEREThe email address where the Gmail report should be sent
PASTE_YOUR_NAME_HEREYour name for the email greeting and sign-off
yourNicheYour industry or focus area (default: SEO and digital marketing) β€” change to match your niche e.g. personal injury law, medical aesthetics, e-commerce
  1. Connect OpenAI β€” Open node 14. OpenAI β€” GPT-4o-mini Model β†’ click the credential dropdown β†’ add your OpenAI API key β†’ test the connection

  2. Create your Google Sheet tab β€” Open your Google Sheet β†’ add a tab named exactly YouTube Intelligence β†’ add these 15 column headers in row 1: Date, Video URL, Title, Channel, Views, Duration, Published, Summary, Key Topics, Best Quote, Target Audience, Relevance Score, Content Gap, Submitted By, Logged At

  3. Connect Google Sheets β€” Open node 17. Google Sheets β€” Log Video Analysis β†’ click the credential dropdown β†’ add Google Sheets OAuth2 β†’ sign in with your Google account β†’ authorize access

  4. Connect Gmail β€” Open node 20. Gmail β€” Send Intelligence Report β†’ click the credential dropdown β†’ add Gmail OAuth2 β†’ sign in with the Gmail account that matches your email address β†’ authorize access

  5. Activate the workflow β€” Toggle the workflow to Active β†’ copy the Form URL from node 1. Form β€” YouTube Video Intelligence β†’ open it in a browser to submit your first videos


How It Works (Step by Step)

Step 1 β€” Form: YouTube Video Intelligence You open the form URL in a browser and paste up to 3 YouTube video URLs. Only Video 1 is required β€” Videos 2 and 3 can be left blank. Your name is optional. Submitting the form starts the workflow.

Step 2 β€” Set: Config Values Your YouTube API key, WayinVideo API key, Google Sheet ID, recipient email, sender name, niche, and all three video URLs are stored here. Today’s date is auto-generated. Your name is also captured from the form.

Step 3 β€” Code: Extract Video IDs The three URL fields are filtered β€” any blank entries or non-YouTube links are removed. Valid YouTube URLs (both youtube.com/watch?v= and youtu.be/ formats) are parsed to extract the video ID. Each valid video becomes its own separate entry so the rest of the workflow processes each video independently. If no valid YouTube URLs are found, the workflow stops with a clear error.

Step 4 β€” HTTP: Fetch YouTube Metadata A request is sent to the YouTube Data API v3 for each video ID. It retrieves the video’s snippet (title, channel, description, publish date), statistics (view count), and content details (duration in ISO 8601 format). If the video is private or does not exist, the workflow stops with an error for that video.

Step 5 β€” Code: Process Video Metadata The ISO 8601 duration (e.g. PT1H23M45S) is converted into a readable format (e.g. 1h 23m 45s). The view count is formatted with comma separators (e.g. 1,234,567). The publish date is formatted as day-month-year. All metadata is packaged for the transcription step.

Step 6 β€” HTTP: Submit Transcription Task Each video URL is submitted to the WayinVideo transcription API with the target language set to English. WayinVideo returns a task ID confirming the transcription job was accepted and is processing.

Step 7 β€” Code: Save Transcript Task ID The WayinVideo task ID is saved along with all video metadata. A poll counter is initialized at zero to track how many times the transcript status has been checked.

Step 8 β€” Wait: 45 Seconds The workflow pauses for 45 seconds before checking the transcription status for the first time, giving WayinVideo time to begin processing.

Step 9 β€” HTTP: Poll Transcript Results A GET request checks the WayinVideo results endpoint using the task ID. It returns the current status and, once complete, the full transcript with speaker labels and text segments.

Step 10 β€” Code: Check Transcript Status The poll counter is incremented and the status is evaluated. If SUCCEEDED, the transcript segments are grouped by speaker into readable text (e.g. Speaker A: text here). The transcript is capped at 5,000 characters. If the transcript is empty or under 50 characters, the workflow uses the video description as a fallback with a clear label. FAILED throws an error and stops. Still processing continues the loop. If 15 polls pass without success (approximately 11 minutes), the workflow times out.

Step 11 β€” IF: Transcript Ready? This is the transcription gate. If the transcript is ready (YES path), the workflow moves to AI analysis. If still processing (NO path), the workflow routes to 12. Set β€” Still Processing Loop Back which carries all the video data forward and loops back to 8. Wait β€” 45 Seconds for another cycle.

Step 12 β€” Set: Still Processing Loop Back This step preserves all video metadata and config values while looping back to the wait step. This is necessary because the wait step resets the context β€” all fields are explicitly re-set here so nothing is lost between polling cycles.

Step 13 β€” AI Agent: Analyze Video GPT-4o-mini receives the video metadata and transcript. It returns six structured fields: a 3–4 sentence summary of what the video covers, an array of 5 key topics, the single most memorable quote from the transcript, a one-sentence description of who the video is best for, a relevance score from 1–10 for your specific niche, and one content gap the video missed that would be valuable for your niche audience.

Step 14 β€” OpenAI: GPT-4o-mini Model This is the language model powering the analysis. It runs at temperature 0.2 for consistent, factual output and is capped at 600 tokens to keep analyses concise and costs low.

Step 15 β€” Parser: Structured Video Analysis This step enforces the exact six-field schema GPT-4o-mini must return. It validates that all required fields are present and correctly typed before results move forward.

Step 16 β€” Code: Prepare Results The AI output is merged with all video metadata. The relevance score is formatted as β€œX out of 10 β€” High/Medium/Low” using the labels High (8–10), Medium (5–7), and Low (1–4). The key topics array is joined as a comma-separated string for the sheet column. A logged-at timestamp is generated.

Step 17 β€” Google Sheets: Log Video Analysis One row is appended to your YouTube Intelligence tab with all 15 columns populated.

Step 18 β€” IF: Last Video? After each video is logged, this check reads the isLastVideo flag. If true (YES path β€” all videos processed), the workflow moves to build and send the Gmail report. If false (NO path β€” more videos still processing), the workflow routes to 21. Set β€” More Videos and continues.

Step 19 β€” Code: Build Gmail Report All processed video results are collected and sorted by relevance score from highest to lowest. The email subject includes the number of videos analyzed and today’s date. The body includes a full breakdown for each video: title, channel, view count, duration, publish date, URL, relevance score, summary, key topics, best quote, target audience, and content gap.

Step 20 β€” Gmail: Send Intelligence Report The complete report is sent to your email address. One email covers all videos, sorted by relevance, with no attribution footer.


Key Features

βœ… Real YouTube metadata β€” Title, channel, views, duration, and publish date are pulled directly from the YouTube Data API β€” not scraped or guessed βœ… Speaker-labeled transcription β€” WayinVideo groups the transcript by speaker so GPT receives structured dialogue, not a wall of undifferentiated text βœ… Transcript fallback to description β€” If WayinVideo returns an empty transcript, the video description is used automatically so no video analysis ever fails silently βœ… Niche-specific relevance scoring β€” You set your niche once in Config Values and every video is scored on how useful it is specifically for that industry βœ… Content gap per video β€” Every analysis includes one thing the video missed β€” ready to use as a content brief or competitive edge βœ… Retry loop with 11-minute timeout β€” The workflow polls every 45 seconds for up to 15 attempts before stopping β€” long videos never hang the workflow indefinitely βœ… Gmail report sorted by relevance β€” All videos arrive ranked from most to least relevant so you always know which one to act on first βœ… Permanent research library in Sheets β€” Every video you submit is logged permanently β€” over time you build a searchable database of analyzed YouTube content sorted by niche relevance


Customisation Options

Change your niche between submissions β€” In node 2. Set β€” Config Values, update yourNiche before each batch submission to score videos against a different industry β€” useful for agencies analyzing videos for multiple client verticals in one workflow instance.

Increase the polling timeout for very long videos β€” In node 10. Code β€” Check Transcript Status, change pollCount >= 15 to pollCount >= 25 to allow up to approximately 19 minutes for transcription β€” useful for videos over 60 minutes long.

Add a Slack notification when the report is ready β€” After node 20. Gmail β€” Send Intelligence Report, add a Slack step that posts the top-scoring video title, relevance score, and the content gap to a #content-team or #research channel so your team sees the headline insight immediately.

Filter to only high-relevance videos in the email β€” In node 19. Code β€” Build Gmail Report, add a filter before sorting: const sorted = [...allItems].filter(v => v.rawScore >= 7).sort(...) to include only videos scoring 7 or above in the email β€” keeping the report focused on the most actionable content.

Log to a separate sheet tab per niche β€” In node 2. Set β€” Config Values, make sheetName dynamic by appending your niche value (e.g. YouTube Intelligence β€” SEO) so different niche batches automatically log to their own dedicated tabs.


Troubleshooting

Form submission not starting the workflow:

YouTube API returning no video data:

WayinVideo transcription timing out or failing:

OpenAI not generating the analysis:

Google Sheets not logging rows or Gmail not arriving:


Support

Need help setting this up or want a custom version built for your team or agency?

πŸ“§ Email: info@incrementors.com 🌐 Website: https://www.incrementors.com/

πŸ”— Nodes Used

Google Sheets, HTTP Request, Gmail, AI Agent, OpenAI Chat Model, Structured Output Parser

πŸ“₯ Import

Download workflow.json and import into n8n: Workflow menu β†’ Import from File

πŸ“– Importing guide Β· πŸ”‘ Credential setup