Classify YouTube Videos & Generate Email Summaries with GPT-4 and Gmail
Classify YouTube Trends and Generate Email Summaries with GPT-4 and Gmail
Monitor YouTube channels, fetch stats, classify videos as viral (≥ 1000 likes) or normal, and auto‑generate LinkedIn/email summaries with GPT‑4. Deliver via Gmail or SMTP. Clear node names, examples, and auditable fields.
🎯 Overview This template monitors YouTube channels via RSS or the YouTube Data API, retrieves video stats, classifies each video as viral (≥ 1000 likes) or normal, and produces concise LinkedIn/email summaries with OpenAI (GPT‑4 family). It can send a compact weekly briefing via Gmail (OAuth2) or SMTP. Built for creators, marketing teams, and agencies who want automated trend alerts and ready‑to‑use content.
This screenshot shows the Gmail-ready weekly briefing generated by the Generate Weekly Briefing (HTML) node in my YouTube Trend Detector workflow, confirming the end-to-end pipeline: RSS/API → stats → like-based classification (≥ 1000 = viral) → LLM summaries → HTML email.
🧭 How It Works (Node Map)
Manual Run – ad‑hoc execution
Set Channel IDs – provide one or more YouTube channelId values
Split Channels – process channels one by one
Fetch Latest Videos (RSS) – pull recent uploads via channel RSS
Filter: Published in Last 72h – only recent items are kept
Get Video Stats (YouTube API) – request snippet,statistics for likes and details
Classify by Likes (Code) – sets classification to viral or normal
Branch: Normal / Branch: Viral – separate LLM prompts per relevance
Write Post (Normal / Viral) – generate LinkedIn‑style notes via OpenAI
Aggregate Posts for Briefing – merge all texts into one block
Generate Weekly Briefing (HTML) – produce a Gmail‑robust HTML email via GPT
Send Weekly Briefing (Gmail/SMTP) – deliver briefing (you set recipients)
⚙️ Quick Start (≈ 3 minutes)
Import the sanitized JSON into n8n (Menu → Import).
Create credentials (use exact names):
YouTube_API_Key — Generic credential (field: apiKey)
OpenAi account — OpenAI API Key
Gmail account (OAuth2) or SMTP_Default (SMTP)
Configure channels: In Set Channel IDs, list your YouTube channelId values (e.g., UC…).
Set recipients: In Send Weekly Briefing, add your target email(s).
Test: Run Execute Workflow and review outputs from the LLM and send nodes.
🔑 Required Credentials
YouTube_API_Key** — YouTube Data API v3 key (field apiKey)
OpenAi account** — OpenAI API key for LLM nodes
Gmail account* (OAuth2, recommended) or SMTP_Default* (server/port/TLS + app password if 2FA)
🧩 Key Parameters & Adjustments
Viral threshold:** In Classify by Likes (Code) → const THRESHOLD = 1000;
YouTube API parts:** Use part=snippet,statistics to obtain likeCount
Time window:* The filter keeps videos from the last 72 hours*
🧪 Troubleshooting
Missing likeCount / classification = "unknown"** → ensure part=statistics and a valid API key credential.
Gmail OAuth redirect_mismatch / access_denied** → redirect must be https://<your-n8n-host>/rest/oauth2-credential/callback and test users added if restricted.
SMTP auth issues** → set correct server/port/TLS and use an app password when 2FA is enabled.
Empty LLM output** → verify OpenAI key/quota and inspect node logs.
🧾 Example Outputs
-
Classification (single video) { "videoId": "abc123XYZ", "title": "How to Ship an n8n Workflow with OpenAI", "likeCount": 1587, "classification": "viral", "needsStatsFetch": false }
-
LinkedIn draft (viral) Did you know how much faster prompt workflows get with structured inputs? • Setup: n8n + YouTube API + OpenAI for auto-briefs • Tip: include part=statistics for reliable like counts Useful for teams tracking trending how-to content. What’s your best “viral” signal besides likes? #n8n #YouTubeAPI #OpenAI #Automation #Growth
-
Plain‑text email preview Subject: Weekly AI Briefing — YouTube Trend Highlights
Hi team, Highlights from our tracked channels: • Viral: “How to Ship an n8n Workflow with OpenAI” (1.6k likes) • Normal: “RSS vs API: What’s Best for Monitoring?” Generated via n8n + GPT‑4.
✅ Submission Checklist (meets the guidelines)
Title clarity:* Mentions GPT‑4 and Gmail*
Language:* Entire document in English*
Node naming:** Descriptive, non‑generic labels
HTML → Markdown:* No HTML in this description; badges are Markdown images*
Examples:** Included (JSON, LinkedIn draft, email)
Security:** No secrets in JSON; uses credentials by name
📸 Suggested Screenshots (optional)
Full canvas overview (entire workflow)
LLM output (expanded) showing generated summary
Send‑node result with messageId/status
Optional: aggregated briefing preview
📜 License & Support
License: MIT
Support/Contact: kaihoelters@yahoo.de
Related Templates
Instagram Full Profile Scraper with Apify and Google Sheets
📸 Instagram Full Profile Scraper with Apify and Google Sheets This n8n workflow automates the process of scraping ful...
Technology News Workflow Explanation with Key Services
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. Auto-Publish Techn...
Auto-classify Gmail emails with AI and apply labels for inbox organization
Who is this for? Professionals and individuals who receive high volumes of emails, those who want to automatically organ...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments