Détection de vidéos YouTube virales par analyse IA et envoi de rapports par e-mail

Avancé

Ceci est unMiscellaneous, AI Summarization, Multimodal AIworkflow d'automatisation du domainecontenant 26 nœuds.Utilise principalement des nœuds comme Set, Code, Sort, Gmail, Limit. Détection des vidéos YouTube virales et envoi de rapports par e-mail avec l'analyse IA

Prérequis
  • Compte Google et informations d'identification Gmail API
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
  • Clé API OpenAI
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ce85e8e4-9e2b-46cd-bc0d-1517049e1322",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -272,
        -448
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "62ca03a8-f032-43e2-95af-48bee0a58b53",
      "name": "CalculateMetrics",
      "type": "n8n-nodes-base.code",
      "position": [
        144,
        -144
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "\nconst views = Number($json.ViewCount || 0);\nconst likes = Number($json.likeCount || 0);\nconst comments = Number($json.commentCount || 0);\n\nconst publishedAt = $json.publishedAt || '';\nconst publishTime = new Date (publishedAt).getTime();\nconst now = Date.now();\nconst hoursSincePublish = (now - publishTime) / (1000 * 60 * 60); // Convert millisecond\n\nconst likeRate = views > 0 ? (likes / views) * 100 : 0; // Like percentage \nconst commentRate = views > 0 ? (comments / views) * 100 : 0; // Comment percentage \nconst viewsPerHour = hoursSincePublish > 0 ? views / hoursSincePublish: 0; // Views per\n\nconst title = $json.title || '';\nconst videoID = $json.videoId || '';\nconst youtubeURL = `https://www.youtube.com/watch?v=${videoID}`;\n\nconst channelId = $json.channelID;\nconst channelOpenDate = $json.channelOpenDate;\nconst channelTotalViewCount= $json.channelTotalViewCount;\nconst subscriberCount= $json.subscriberCount ;\nconst categoryID= $json.categoryID;\nconst channelName= $json.channelName;\nconst categoryName= $json.categoryName;\nreturn { \n  title, \n  youtubeURL,  \n  categoryID, \n  categoryName,\n  channelId,\n  channelName,\n  channelOpenDate,\n  channelTotalViewCount,\n  subscriberCount,\n  publishedAt, \n  views,\n  likes, \n  comments, \n  likeRate, \n  commentRate, \n  viewsPerHour\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "584d47e4-3ade-4041-a18d-8f272f12d1fb",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        880,
        -144
      ],
      "parameters": {
        "text": "=json: {{$('Aggregate').item.json.data.toJsonString() }}\n",
        "options": {
          "systemMessage": "=You are an expert YouTube video analyst. Your task is to review a JSON array containing data for {{$('Setup').item.json.maxResult}} YouTube videos, including calculated virality metrics like \"algorithmicLiftScore\", \"viewsPerSubscriber\", and \"relativeEngagementRate\".\n\nYour goal is to provide a concise, insightful summary that highlights the most important findings and patterns.\n\n**Output Requirements:**\n\n1.  **Overall Virality Trend:** Briefly describe the general range of \"algorithmicLiftScore\" and identify if there are any exceptionally viral videos based on this score.\n2.  **Top 3 Most Viral Videos:** List the top 3 videos by \"algorithmicLiftScore\". For each, include:\n    *   Title\n    *   youtubeURL\n    *   Channel Name and Subscriber Count\n    *   views\n    *   viewsPerHour\n    *   Algorithmic Lift Score\n    *   Key reason for high score (e.g., \"extremely high views per subscriber,\" \"exceptional engagement rate for its size,\" \"very rapid view growth\").\n3.  **Key Statistics Averages/Ranges (across all 20 videos):**\n    *   Average `algorithmicLiftScore`\n    *   Average `viewsPerSubscriber`\n    *   Average `relativeEngagementRate`\n    *   Top 3 most common `categoryName` (with count/percentage if possible).\n4.  **Noteworthy Observations/Patterns:**\n    *   Any interesting correlations between `categoryName` and virality.\n    *   Any channels that appear multiple times or show consistent performance.\n    *   Any videos with surprisingly high or low `likeRate` or `commentRate` compared to their `views`.\n    *   General sentiment or common themes in the titles (e.g., \"AI,\" \"shorts,\" \"comedy\").\n5.  **Conciseness:** Keep the summary to a maximum of 300 words. Use bullet points or short paragraphs for readability.\n\n\n**JSON Input example:**\n\"\"\"\n[\n  {\n    \"title\": \"🌟Guess Who #kpop #kpopdemonhunters #sussie #ai\",\n    \"youtubeURL\": \"https://www.youtube.com/watch?v=dfgrtgrrt4t\",\n    \"categoryID\": \"24\",\n    \"categoryName\": \"Entertainment\",\n    \"channelId\": \"UCYCBxphosvertg_ZOmAvdsfvsd\",\n    \"channelName\": \"krytoi oker\",\n    \"channelOpenDate\": \"2025-08-26T12:11:27.987819Z\",\n    \"channelTotalViewCount\": 25715501,\n    \"subscriberCount\": 6650,\n    \"publishedAt\": \"2025-09-06T13:22:10Z\",\n    \"views\": 2646019,\n    \"likes\": 9249,\n    \"comments\": 15,\n    \"likeRate\": 0.0034954397530781145,\n    \"commentRate\": 0.000005668893534022243,\n    \"viewsPerHour\": 65672.62637656713,\n    \"algorithmicLiftScore\": 239.3253287501648,\n    \"relativeEngagementRate\": 0.35011086466121366,\n    \"logViewsPerHour\": 4.817390997890299,\n    \"hoursSincePublished\": 40.29104888888889,\n    \"viewsPerSubscriber\": 397.8975939849624\n  },\n  {\n    \"title\": \"New York help PLEASE! 🙏 #funny #baby #ai #cute #reels #comedy #shorts #trending\",\n    \"youtubeURL\": \"https://www.youtube.com/watch?v=NLKm8HM5453gs\",\n    \"categoryID\": \"24\",\n    \"categoryName\": \"Entertainment\",\n    \"channelId\": \"UCu22ALsY7fvsfvsdrgtsg\",\n    \"channelName\": \"Yazt Creationz\",\n    \"channelOpenDate\": \"2022-11-25T06:58:20.821126Z\",\n    \"channelTotalViewCount\": 21190181,\n    \"subscriberCount\": 30800,\n    \"publishedAt\": \"2025-09-06T12:33:13Z\",\n    \"views\": 937872,\n    \"likes\": 8387,\n    \"comments\": 25,\n    \"likeRate\": 0.008942584915638808,\n    \"commentRate\": 0.000026656089530341027,\n    \"viewsPerHour\": 22815.449610843752,\n    \"algorithmicLiftScore\": 18.975135803015906,\n    \"relativeEngagementRate\": 0.896924100516915,\n    \"logViewsPerHour\": 4.358248066270673,\n    \"hoursSincePublished\": 41.106882222222225,\n    \"viewsPerSubscriber\": 30.45038961038961\n  }\n]"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "2ed02259-c6b8-4568-bf17-306b53685efd",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1008,
        -272
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "76a2b5f9-fa21-4f20-a7cb-8f643575e9a8",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        864,
        -272
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "lZXeo8SqoOzu2TkW",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "73c079e8-1cef-48f7-9904-c95fa479d0a8",
      "name": "Sort",
      "type": "n8n-nodes-base.sort",
      "position": [
        448,
        -144
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "order": "descending",
              "fieldName": "algorithmicLiftScore"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "141a3525-0575-4ec8-ae72-36e5a8f50cd5",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -272,
        -256
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 13
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b53a3146-f068-4be3-8821-6a54962db65c",
      "name": "GetChannelInfo",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        -624
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/channels?",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "={{ $('Setup').item.json.GoogleAPIkey }}"
            },
            {
              "name": "part",
              "value": "snippet, statistics, topicDetails"
            },
            {
              "name": "id",
              "value": "={{ $json['items.snippet.channelId'] }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d54b9774-3c20-4804-b41b-978b59603bc1",
      "name": "SearchVideos",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        96,
        -448
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/search?",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "={{ $('Setup').item.json.GoogleAPIkey }}"
            },
            {
              "name": "part",
              "value": "snippet"
            },
            {
              "name": "order",
              "value": "=viewCount"
            },
            {
              "name": "type",
              "value": "video"
            },
            {
              "name": "publishedAfter",
              "value": "={{ $now.minus({ days: $('Setup').item.json.daysback }).toUTC().toISO() }}"
            },
            {
              "name": "q",
              "value": "={{ $('Setup').item.json.query }}"
            },
            {
              "name": "maxResults",
              "value": "={{ $('Setup').item.json.maxResult }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c6c2bbe2-1a6c-4a46-a859-6c7ccf5dbd25",
      "name": "Split Out1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        256,
        -448
      ],
      "parameters": {
        "include": "selectedOtherFields",
        "options": {},
        "fieldToSplitOut": "items",
        "fieldsToInclude": "videoId,channelId, publishedAt, "
      },
      "typeVersion": 1
    },
    {
      "id": "2d29fd18-f796-4e40-aeb0-4af21a4939b5",
      "name": "Split Out2",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        416,
        -448
      ],
      "parameters": {
        "include": "selectedOtherFields",
        "options": {},
        "fieldToSplitOut": "items.snippet.channelId",
        "fieldsToInclude": "items.snippet.channelId, items.snippet.publishedAt, items.id.videoId"
      },
      "typeVersion": 1
    },
    {
      "id": "32b9f4a4-87cc-4638-a67e-8cf1b2a6e334",
      "name": "GetVidStats",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        -448
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/videos?",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "={{ $('Setup').item.json.GoogleAPIkey }}"
            },
            {
              "name": "part",
              "value": "snippet,statistics"
            },
            {
              "name": "id",
              "value": "={{ $json['items.id.videoId'] }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5c09783e-2f84-4705-ab5d-e14b3bf32a80",
      "name": "ChannelInfo",
      "type": "n8n-nodes-base.code",
      "position": [
        832,
        -624
      ],
      "parameters": {
        "jsCode": "const output = [];\n\n\nfor (const item of items) {\n  \n  const channelData = item.json;\n\n  \n  if (channelData.items && channelData.items.length > 0) {\n    const channel = channelData.items[0];\n    output.push({\n      channelName: channel.snippet.title,\n      channelID: channel.id,\n      channelOpenDate: channel.snippet.publishedAt,\n      channelTotalViewCount: parseInt(channel.statistics.viewCount,10),\n      subscriberCount: parseInt(channel.statistics.subscriberCount,10),\n    });\n  }\n}\n\nreturn output;"
      },
      "typeVersion": 2
    },
    {
      "id": "fc0823b9-890b-4f0f-beb2-03a18b5e7a97",
      "name": "VidStats",
      "type": "n8n-nodes-base.code",
      "position": [
        832,
        -448
      ],
      "parameters": {
        "jsCode": "const output = [];\n\n\nconst youtubeCategories = {\n  \"1\": \"Film & Animation\",\n  \"2\": \"Autos & Vehicles\",\n  \"10\": \"Music\",\n  \"15\": \"Pets & Animals\",\n  \"17\": \"Sports\",\n  \"18\": \"Short Movies\",\n  \"19\": \"Travel & Events\",\n  \"20\": \"Gaming\",\n  \"21\": \"Videoblogging\",\n  \"22\": \"People & Blogs\",\n  \"23\": \"Comedy\",\n  \"24\": \"Entertainment\",\n  \"25\": \"News & Politics\",\n  \"26\": \"Howto & Style\",\n  \"27\": \"Education\",\n  \"28\": \"Science & Technology\",\n  \"29\": \"Nonprofits & Activism\",\n  \"30\": \"Movies\",\n  \"31\": \"Anime/Animation\",\n  \"32\": \"Action/Adventure\",\n  \"33\": \"Classics\",\n  \"34\": \"Comedy\",\n  \"35\": \"Documentary\",\n  \"36\": \"Drama\",\n  \"37\": \"Family\",\n  \"38\": \"Foreign\", // Note: YouTube's own categories can have overlaps or changes\n  \"39\": \"Horror\",\n  \"40\": \"Sci-Fi/Fantasy\",\n  \"41\": \"Thriller\",\n  \"42\": \"Shorts\",\n  \"43\": \"Shows\",\n  \"44\": \"Trailers\"\n};\n\nfor (const item of items) {\n\n  const videoData = item.json;\n\n  if (videoData.items && videoData.items.length > 0) {\n    const video = videoData.items[0]; \n    output.push({\n      title:video.snippet.title,      \n      videoId:video.id,\n      channelID: video.snippet.channelId,\n      categoryID: video.snippet.categoryId,\n      categoryName: youtubeCategories[video.snippet.categoryId] || \"Unknown Category\",\n\n      ViewCount: parseInt(video.statistics.viewCount,10),\n      favoriteCount: parseInt(video.statistics.favoriteCount,10),\n      likeCount: parseInt(video.statistics.likeCount,10),\n      commentCount: parseInt(video.statistics.commentCount,10),\n      publishedAt:video.snippet.publishedAt,\n\n    });\n  }\n}\n\nreturn output;"
      },
      "typeVersion": 2
    },
    {
      "id": "a543b4f8-19fb-44fd-af5d-d4dd506814d8",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        1088,
        -464
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "fieldsToMatchString": "channelID"
      },
      "typeVersion": 3.2
    },
    {
      "id": "f77017ff-a348-4011-8e6d-d3471ba527c0",
      "name": "AlgorithmicLiftScore",
      "type": "n8n-nodes-base.code",
      "position": [
        304,
        -144
      ],
      "parameters": {
        "jsCode": "const output = [];\nconst currentTimestamp = Date.now(); // Get current timestamp in milliseconds\n\nfor (const item of items) {\n  \n  const videoData = item.json;\n\n  const channelId = videoData.channelId; \n  const subscriberCount = Number(videoData.subscriberCount || 0);\n  const videoViews = Number(videoData['views'] || 0); \n  const numberOfLikes = Number(videoData['likes'] || 0); \n  const numberOfComments = Number(videoData['comments'] || 0);\n  const videoPublishedAt = videoData.publishedAt; \n\n\n  // --- 1. Calculate hoursSincePublished ---\n  let hoursSincePublished;\n  try {\n    const publishedDate = new Date(videoPublishedAt);\n    if (isNaN(publishedDate.getTime())) {\n      throw new Error(`Invalid videoPublishedAt date: \"${videoPublishedAt}\"`);\n    }\n    hoursSincePublished = (currentTimestamp - publishedDate.getTime()) / (1000 * 60 * 60);\n    \n    hoursSincePublished = Math.max(1, hoursSincePublished);\n  } catch (e) {\n    \n    hoursSincePublished = 1; // Default to 1 hour if date is invalid or missing\n  }\n  \n\n  // --- 2. Calculate viewsPerHour ---\n  const viewsPerHour = videoViews / hoursSincePublished;\n  \n  // --- 3. Handle effectiveSubscriberCount ---\n  const effectiveSubscriberCount = Math.max(1, subscriberCount); // Avoid division by zero\n  \n  // --- 4. Calculate Views_Per_Subscriber ---\n  const viewsPerSubscriber = videoViews / effectiveSubscriberCount;\n\n  // --- 5. Calculate Relative_Engagement_Rate ---\n  let likeRate = 0;\n  let commentRate = 0;\n  if (videoViews > 0) { // Only calculate rates if there are views to avoid division by zero\n    likeRate = numberOfLikes / videoViews;\n    commentRate = numberOfComments / videoViews;\n  }\n  const relativeEngagementRate = (likeRate + commentRate) * 100;\n\n\n  // --- 6. Calculate Log_Views_Per_Hour (for Normalized_Views_Per_Hour) ---\n  const logViewsPerHour = Math.log10(viewsPerHour + 1); // Add 1 to handle 0 gracefully\n  \n\n  // --- 7. Calculate Algorithmic_Lift_Score (ALS) ---\n  const W1 = 0.6; // Weight for Views_Per_Subscriber\n  const W2 = 0.3; // Weight for Relative_Engagement_Rate\n  const W3 = 0.1; // Weight for Log_Views_Per_Hour\n\n  const algorithmicLiftScore =\n    (W1 * viewsPerSubscriber) +\n    (W2 * relativeEngagementRate) +\n    (W3 * logViewsPerHour);\n\n  // Add the calculated score and other relevant data to the output\n  output.push({\n    json: {\n      ...videoData, // Keep all original data\n      algorithmicLiftScore: algorithmicLiftScore,\n      relativeEngagementRate: relativeEngagementRate,\n      logViewsPerHour: logViewsPerHour,\n      hoursSincePublished: hoursSincePublished,\n      viewsPerHour: viewsPerHour,\n      viewsPerSubscriber: viewsPerSubscriber,\n      likeRate: likeRate,\n      commentRate: commentRate\n    },\n  });\n}\n\nreturn output;"
      },
      "typeVersion": 2
    },
    {
      "id": "12fab598-4dcc-4b5a-8de0-f282dfe912e1",
      "name": "Setup",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        -448
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c052c179-7918-467f-9fa8-4a4d0e2a1df0",
              "name": "query",
              "type": "string",
              "value": "AIvideo"
            },
            {
              "id": "a40f07ae-3312-4118-b1b1-05bca0b43dd1",
              "name": "GoogleAPIkey",
              "type": "string",
              "value": ""
            },
            {
              "id": "3157a6c2-172e-4a1c-93c0-c99a527d4fc0",
              "name": "daysback",
              "type": "number",
              "value": 3
            },
            {
              "id": "33364ded-dc2e-441c-9cdf-3be3dcecac56",
              "name": "maxResult",
              "type": "number",
              "value": 20
            },
            {
              "id": "6dbb8d3a-e95e-4c1e-8b03-45c7f26408f9",
              "name": "email",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "28bf5ada-6880-4de8-a9ec-a1a3aad7ab31",
      "name": "Remove_Duplicates",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        -48,
        -144
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "1ded0269-047c-4c4d-a923-d36e2c4ef6f4",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -1136
      ],
      "parameters": {
        "color": 4,
        "width": 416,
        "height": 480,
        "content": "### **Main Overview**\n\n\n> #### 🚀 **YouTube Viral Video Detector** 🚀\n>\n> Welcome! This workflow automates the discovery and analysis of potentially viral YouTube videos for any niche.\n>\n> **How it works:**\n> 1.  **Searches** for recent, popular YouTube videos based on your keyword.\n> 2.  **Gathers stats** for each video and its channel.\n> 3.  **Calculates** an \"Algorithmic Lift Score\" to identify videos with high viral potential.\n> 4.  **Uses an AI agent** to analyze the top 5 videos and generate an insightful summary.\n> 5.  **Sends you an email** with the AI-powered analysis.\n\n> You may also schedule a trigger \n( default: once daily )\n\n\n\n> **➡️ To get started, follow the 3 setup steps in the other sticky notes!**\n\n**author: gclbck**"
      },
      "typeVersion": 1
    },
    {
      "id": "a66fd69c-4657-4dd5-8ffc-0388823bfb1f",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        592,
        -144
      ],
      "parameters": {
        "maxItems": 5
      },
      "typeVersion": 1
    },
    {
      "id": "9631c00a-9440-42e7-aaae-15fb11163292",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        720,
        -144
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "c2a0b8d8-a7b3-4b7e-a9ba-e4ac319bbfa7",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        1232,
        -144
      ],
      "parameters": {
        "mode": "markdownToHtml",
        "options": {},
        "markdown": "={{ $json.output }}"
      },
      "typeVersion": 1
    },
    {
      "id": "db2e6eb2-24ca-4cf7-895e-4fba6f70b33c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -1136
      ],
      "parameters": {
        "width": 656,
        "height": 480,
        "content": "### **1- Setup Node Configuration**\n\n> #### ⚙️ **Configure Your Search** ⚙️\n>\n> Double-click the **'Setup'** node to define your search parameters.\n>\n> *   **`query`**: The keyword or niche you want to search for (e.g., \"AI\", \"Marketing\", \"Productivity\").\n> *   **`GoogleAPIkey`**: Your Google API key is required to use the YouTube Data API.\n>     *   **How to get a key:**\n>         1.  Go to the [Google Cloud Console](https://console.cloud.google.com/).\n>         2.  Create a new project.\n>         3.  In the API Library, find and enable the **\"YouTube Data API v3\"**.\n>         4.  Go to \"Credentials\" and create a new **\"API key\"**.\n> *   **`daysback`**: How many days in the past to search for videos (e.g., `3` for the last 3 days).\n> *   **`maxResult`**: The number of videos to retrieve for analysis (e.g., `20`). ( avoid higher than `50` considering rateLimits )\n> *   **`e-mail`**: The e-mail address you want the report to be sent.\n>\n> **ACTION:** Update these fields with your search criteria and your Google API key."
      },
      "typeVersion": 1
    },
    {
      "id": "98a83c31-aaf3-489a-9209-85747dc67ecd",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        -1136
      ],
      "parameters": {
        "width": 656,
        "height": 480,
        "content": "### **2- AI Model Setup**\n\n\n> #### 🤖 **Connect Your AI Model** 🤖\n>\n> This workflow uses an AI model to analyze the video data and generate a summary. This template is pre-configured to use **OpenAI**.\n>\n> **ACTION:**\n> 1.  Click on the **'OpenAI Chat Model'** node.\n> 2.  Under 'Credential', select **'Create New'**.\n> 3.  Enter your **OpenAI API key** to connect your account.\n>\n> **Note on Google Generative AI:**\n> If you prefer to use Google's Generative AI (like Gemini), you must replace the `'OpenAI Chat Model'` node with a `'Google Generative AI Chat Model'` node and then add your Google Generative AI API key to its credentials."
      },
      "typeVersion": 1
    },
    {
      "id": "f57223a9-f021-4dd5-9bc9-b59ef73188df",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        -1136
      ],
      "parameters": {
        "width": 656,
        "height": 480,
        "content": "### **3- Gmail Account Setup**\n\n\n> #### 📧 **Set Up Email Notifications** 📧\n>\n> This final step sends the AI-generated analysis to your email address using Gmail.\n>\n> **ACTION:**\n> 1.  Click on the **'Send Mail'** node.\n> 2.  Under 'Credential', select **'Create New'** to connect your Gmail account. You will be prompted to sign in with Google and grant n8n the necessary permissions.\n> 3.  In the **'Send To'** field, replace the placeholder email with the address where you want to receive the report.\n>\n> **✅ Once these 3 steps are complete, you are ready to activate the workflow!**"
      },
      "typeVersion": 1
    },
    {
      "id": "dd7a3947-55e0-4077-8f99-dacb48f9a123",
      "name": "Send_Report",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1440,
        -144
      ],
      "webhookId": "6fbdf951-0234-4af0-b88a-72c4a0bd7c4f",
      "parameters": {
        "sendTo": "={{$('Setup').item.json.email}}",
        "message": "={{ $json.data }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Virality analysis of the last {{ $('Setup').item.json.daysback }} days for keyword: \"{{ $('Setup').item.json.query }}\""
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "85MkbBJIFpUk11Ka",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "pinData": {},
  "connections": {
    "73c079e8-1cef-48f7-9904-c95fa479d0a8": {
      "main": [
        [
          {
            "node": "a66fd69c-4657-4dd5-8ffc-0388823bfb1f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a66fd69c-4657-4dd5-8ffc-0388823bfb1f": {
      "main": [
        [
          {
            "node": "9631c00a-9440-42e7-aaae-15fb11163292",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a543b4f8-19fb-44fd-af5d-d4dd506814d8": {
      "main": [
        [
          {
            "node": "28bf5ada-6880-4de8-a9ec-a1a3aad7ab31",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "12fab598-4dcc-4b5a-8de0-f282dfe912e1": {
      "main": [
        [
          {
            "node": "d54b9774-3c20-4804-b41b-978b59603bc1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2ed02259-c6b8-4568-bf17-306b53685efd": {
      "ai_tool": [
        [
          {
            "node": "584d47e4-3ade-4041-a18d-8f272f12d1fb",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "584d47e4-3ade-4041-a18d-8f272f12d1fb": {
      "main": [
        [
          {
            "node": "c2a0b8d8-a7b3-4b7e-a9ba-e4ac319bbfa7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c2a0b8d8-a7b3-4b7e-a9ba-e4ac319bbfa7": {
      "main": [
        [
          {
            "node": "dd7a3947-55e0-4077-8f99-dacb48f9a123",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fc0823b9-890b-4f0f-beb2-03a18b5e7a97": {
      "main": [
        [
          {
            "node": "a543b4f8-19fb-44fd-af5d-d4dd506814d8",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "9631c00a-9440-42e7-aaae-15fb11163292": {
      "main": [
        [
          {
            "node": "584d47e4-3ade-4041-a18d-8f272f12d1fb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c6c2bbe2-1a6c-4a46-a859-6c7ccf5dbd25": {
      "main": [
        [
          {
            "node": "2d29fd18-f796-4e40-aeb0-4af21a4939b5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2d29fd18-f796-4e40-aeb0-4af21a4939b5": {
      "main": [
        [
          {
            "node": "b53a3146-f068-4be3-8821-6a54962db65c",
            "type": "main",
            "index": 0
          },
          {
            "node": "32b9f4a4-87cc-4638-a67e-8cf1b2a6e334",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5c09783e-2f84-4705-ab5d-e14b3bf32a80": {
      "main": [
        [
          {
            "node": "a543b4f8-19fb-44fd-af5d-d4dd506814d8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "32b9f4a4-87cc-4638-a67e-8cf1b2a6e334": {
      "main": [
        [
          {
            "node": "fc0823b9-890b-4f0f-beb2-03a18b5e7a97",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dd7a3947-55e0-4077-8f99-dacb48f9a123": {
      "main": [
        []
      ]
    },
    "d54b9774-3c20-4804-b41b-978b59603bc1": {
      "main": [
        [
          {
            "node": "c6c2bbe2-1a6c-4a46-a859-6c7ccf5dbd25",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b53a3146-f068-4be3-8821-6a54962db65c": {
      "main": [
        [
          {
            "node": "5c09783e-2f84-4705-ab5d-e14b3bf32a80",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "62ca03a8-f032-43e2-95af-48bee0a58b53": {
      "main": [
        [
          {
            "node": "f77017ff-a348-4011-8e6d-d3471ba527c0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "141a3525-0575-4ec8-ae72-36e5a8f50cd5": {
      "main": [
        [
          {
            "node": "12fab598-4dcc-4b5a-8de0-f282dfe912e1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "76a2b5f9-fa21-4f20-a7cb-8f643575e9a8": {
      "ai_languageModel": [
        [
          {
            "node": "584d47e4-3ade-4041-a18d-8f272f12d1fb",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "28bf5ada-6880-4de8-a9ec-a1a3aad7ab31": {
      "main": [
        [
          {
            "node": "62ca03a8-f032-43e2-95af-48bee0a58b53",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f77017ff-a348-4011-8e6d-d3471ba527c0": {
      "main": [
        [
          {
            "node": "73c079e8-1cef-48f7-9904-c95fa479d0a8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ce85e8e4-9e2b-46cd-bc0d-1517049e1322": {
      "main": [
        [
          {
            "node": "12fab598-4dcc-4b5a-8de0-f282dfe912e1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Divers, Résumé IA, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds26
Catégorie3
Types de nœuds17
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
gclbck

gclbck

@gclbck

Seasoned Data&ML Engineer over 20 years of experience in data processing, analytics and CRM. Non-Stop learner, Passionate in efficiency through Agentic Automation.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34