使用参与度评分和Google Sheets分析YouTube视频的病毒内容
高级
这是一个Market Research领域的自动化工作流,包含 22 个节点。主要使用 Set, Code, Wait, Merge, FormTrigger 等节点。 使用参与度评分和Google Sheets分析YouTube视频的病毒内容
前置要求
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "40e2ddc17723de14c7d0537f9006dd246a3f4df33df6ca7f746ccb612d5f27b9",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "fa800f3c-f679-4d51-a3dc-30c07531e7e1",
"name": "获取视频数据",
"type": "n8n-nodes-base.httpRequest",
"position": [
1420,
660
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/videos",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet,statistics,contentDetails,status,topicDetails,recordingDetails,liveStreamingDetails,localizations,player"
},
{
"name": "id",
"value": "={{ $json.videoid }}"
},
{
"name": "key",
"value": "={{ $('Set you keys').item.json.api_key }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "7d1d2e06-a1ab-4e37-8e27-fe30abe312fd",
"name": "获取视频ID",
"type": "n8n-nodes-base.httpRequest",
"position": [
280,
440
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/search",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet"
},
{
"name": "maxResults",
"value": "={{ $json.videoLimit || 1}}"
},
{
"name": "order",
"value": "viewCount"
},
{
"name": "publishedAfter",
"value": "={{ $now.minus({days: 7}).startOf('day').toISO() }}"
},
{
"name": "publishedBefore",
"value": "={{ $now.toISO() }}"
},
{
"name": "q",
"value": "={{ $json.search_term }}"
},
{
"name": "type",
"value": "video"
},
{
"name": "videoDuration",
"value": "={{ $json.format }}"
},
{
"name": "key",
"value": "={{ $json.api_key }}"
},
{
"name": "regionCode",
"value": "US"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "9c779f52-da65-4d4d-943f-982eb87a6170",
"name": "提取ID",
"type": "n8n-nodes-base.code",
"position": [
600,
660
],
"parameters": {
"jsCode": "const items = $input.all();\nreturn items.flatMap(item => \n (item.json?.items || []).map(videoItem => ({\n json: {\n videoid: videoItem?.id?.videoId || null\n }\n }))\n);"
},
"typeVersion": 2
},
{
"id": "05d526bd-92ec-4ff4-8fa1-526fc44eace7",
"name": "提取视频数据",
"type": "n8n-nodes-base.code",
"position": [
1760,
880
],
"parameters": {
"jsCode": "const items = $input.all();\nreturn items.flatMap(item =>\n (item.json?.items || []).map(videoItem => ({\n json: {\n channelTitle: videoItem.snippet?.channelTitle || '',\n channel:\"https://www.youtube.com/channel/\"+$input.first().json.items[0].snippet.channelId,\n title: videoItem.snippet?.title || '',\n viewCount: videoItem.statistics?.viewCount || 0,\n likeCount: videoItem.statistics?.likeCount || 0,\n commentCount: videoItem.statistics?.commentCount || 0,\n videoURL: `https://www.youtube.com/watch?v=${videoItem.id || ''}`,\n thumbnail: videoItem.snippet?.thumbnails?.maxres?.url || '',\n thumbnailPreview:`=IMAGE(\"${videoItem.snippet?.thumbnails?.maxres?.url || ''}\" ,4,200,150)`\n }\n }))\n);"
},
"typeVersion": 2
},
{
"id": "51b68aa9-1ee9-434d-8509-2f7488764969",
"name": "视频表现",
"type": "n8n-nodes-base.code",
"position": [
1980,
880
],
"parameters": {
"jsCode": "const items = $input.all();\nreturn items.map(item => {\n const viewCount = parseInt(String(item.json?.viewCount || '0'), 10);\n const likeCount = parseInt(String(item.json?.likeCount || '0'), 10);\n const commentCount = parseInt(String(item.json?.commentCount || '0'), 10);\n\n \n let performance = 0;\n \n if (viewCount > 0) {\n // Calculate engagement rate and scale by 10x for more realistic YouTube scores\n const engagementRate = ((likeCount + commentCount) / viewCount) * 1000; // 10x boost\n performance = Math.min(Math.max(engagementRate, 0), 100);\n }\n \n const roundedPerformance = Math.round(performance);\n \n let performanceText = \"💀 Dead\";\n \n // Adjusted thresholds for realistic YouTube engagement rates (much stricter)\n if (roundedPerformance >= 80) {\n performanceText = \"🚀 HOLY HELL\"; // 8%+ engagement = truly exceptional/viral\n } else if (roundedPerformance >= 60) {\n performanceText = \"🔥 INSANE\"; // 6%+ engagement = insane performance\n } else if (roundedPerformance >= 40) {\n performanceText = \"💪 CRUSHING IT\"; // 4%+ engagement = crushing it\n } else if (roundedPerformance >= 30) {\n performanceText = \"⭐ Stellar\"; // 3%+ engagement = stellar\n } else if (roundedPerformance >= 20) {\n performanceText = \"💪 Strong\"; // 2%+ engagement = strong\n } else if (roundedPerformance >= 15) {\n performanceText = \"😊 Good\"; // 1.5%+ engagement = good\n } else if (roundedPerformance >= 10) {\n performanceText = \"🙂 Decent\"; // 1%+ engagement = decent\n } else if (roundedPerformance >= 5) {\n performanceText = \"😐 Average\"; // 0.5%+ engagement = average\n } else {\n // Use switch for very low scores (0-4%)\n switch(roundedPerformance) {\n case 0: performanceText = \"💀 Dead\"; break;\n case 1: performanceText = \"😴 Sleeping\"; break;\n case 2: performanceText = \"😐 Meh\"; break;\n case 3: performanceText = \"😕 Not good\"; break;\n case 4: performanceText = \"😞 Poor\"; break;\n default: performanceText = \"💀 Dead\";\n }\n }\n $input.first().json.performance = performance;\n $input.first().json.performanceText = performanceText;\n \n \n return {\n ...$json\n };\n});"
},
"typeVersion": 2
},
{
"id": "0112f55c-b506-4a08-8ce4-7f5c8b8a0e3e",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
620
],
"parameters": {
"color": 4,
"width": 344,
"height": 208,
"content": "# 开始"
},
"typeVersion": 1
},
{
"id": "9d7abab9-7af2-4b2f-a1bf-d07086a95330",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
20,
220
],
"parameters": {
"color": 5,
"width": 336,
"height": 192,
"content": "# 视频ID"
},
"typeVersion": 1
},
{
"id": "c5d4d3a4-2f54-42e6-bf6e-914e8cb3c9b7",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
600,
820
],
"parameters": {
"width": 432,
"height": 196,
"content": "# 提取ID"
},
"typeVersion": 1
},
{
"id": "fb8111db-b21c-44b1-b4f8-8251cf09e720",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1160,
340
],
"parameters": {
"color": 5,
"width": 408,
"height": 224,
"content": "# 获取视频数据"
},
"typeVersion": 1
},
{
"id": "c338fb9c-2eeb-425c-a234-49c2d948cccc",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1180,
860
],
"parameters": {
"width": 364,
"height": 192,
"content": "# 提取视频数据"
},
"typeVersion": 1
},
{
"id": "933503b9-507a-422a-9dcd-a520466cee01",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1700,
160
],
"parameters": {
"width": 352,
"height": 192,
"content": "# 视频表现"
},
"typeVersion": 1
},
{
"id": "6e286763-02b6-4dd3-9c0b-6233ce64aa62",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
2440,
360
],
"parameters": {
"color": 5,
"width": 432,
"height": 240,
"content": "# 发送到 Google Sheets"
},
"typeVersion": 1
},
{
"id": "8bf37e0f-9b9c-4f16-be2e-02ea952c4488",
"name": "在表格中追加行",
"type": "n8n-nodes-base.googleSheets",
"position": [
2720,
640
],
"parameters": {
"columns": {
"value": {},
"schema": [
{
"id": "viewCount",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "viewCount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "subscriberCount",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "subscriberCount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "hiddenSubscriberCount",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "hiddenSubscriberCount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "videoCount",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "videoCount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "channelTitle",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "channelTitle",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "channel",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "channel",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "likeCount",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "likeCount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "commentCount",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "commentCount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "videoURL",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "videoURL",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "thumbnail",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "thumbnail",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "thumbnailPreview",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "thumbnailPreview",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "performance",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "performance",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "performanceText",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "performanceText",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "youtubeUrl",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "youtubeUrl",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "label",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "label",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "viewToSubRatio",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "viewToSubRatio",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {
"useAppend": true
},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1oOxuTacCQ_57knZTaTtohQZ9qYY2WHmozes-E-1YG_I/edit#gid=0",
"cachedResultName": "Youtube Videos"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1oOxuTacCQ_57knZTaTtohQZ9qYY2WHmozes-E-1YG_I",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1oOxuTacCQ_57knZTaTtohQZ9qYY2WHmozes-E-1YG_I/edit?usp=drivesdk",
"cachedResultName": "YouTube Viral Videos"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "9NL9w5d9bKz7xt16",
"name": "Akash Google Sheet Account"
}
},
"typeVersion": 4.6
},
{
"id": "433ee6cf-2c84-4131-9bf8-a0f00d1c04ca",
"name": "表单提交时",
"type": "n8n-nodes-base.formTrigger",
"position": [
-240,
440
],
"webhookId": "77ab6399-3597-439f-a2b2-3641e7a4fceb",
"parameters": {
"options": {},
"formTitle": "test",
"formFields": {
"values": [
{
"fieldLabel": "Share your idea?",
"placeholder": "Eg. Best automation tool",
"requiredField": true
},
{
"fieldType": "dropdown",
"fieldLabel": "Format",
"fieldOptions": {
"values": [
{
"option": "short"
},
{
"option": "medium"
},
{
"option": "long"
}
]
},
"requiredField": true
},
{
"fieldType": "number",
"fieldLabel": "Number of Videos",
"placeholder": "Enter number of video to research by default 1",
"requiredField": true
}
]
},
"formDescription": "tets"
},
"typeVersion": 2.2
},
{
"id": "e7daac48-5d66-4ba3-8753-614f46d40515",
"name": "获取频道统计数据",
"type": "n8n-nodes-base.httpRequest",
"position": [
1760,
420
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/channels",
"options": {
"redirect": {
"redirect": {}
}
},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet,statistics,contentDetails"
},
{
"name": "id",
"value": "={{ $json.items[0].snippet.channelId }}"
},
{
"name": "key",
"value": "={{ $('Set you keys').item.json.api_key }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "f06636a4-df6c-4de4-bfed-6b44b5835c85",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
2240,
640
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineAll"
},
"typeVersion": 3.2
},
{
"id": "d97a43b5-4646-4e2b-b6f3-e815dac5eeed",
"name": "频道数据",
"type": "n8n-nodes-base.code",
"position": [
1980,
420
],
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nvar json = {}\n\njson = $input.first().json.items[0].statistics;\n\n\nreturn [json];"
},
"typeVersion": 2
},
{
"id": "2856d447-5cc2-428b-a443-d6cd9d0d2ecd",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
2460,
640
],
"parameters": {
"jsCode": "return $input.all().map(item => {\n const views = parseInt(item.json.viewCount || '0');\n const subs = parseInt(item.json.subscriberCount || '0');\n\n let label = '';\n const ratio = subs > 0 ? views / subs : 0;\n\n if ((subs < 500 && views > 5000) || (ratio > 1 && subs > 1000)) {\n label = 'Outlier';\n } else if (ratio < 0.02) {\n label = 'Bad';\n } else if (ratio >= 0.02 && ratio < 0.1) {\n label = 'Okay';\n } else if (ratio >= 0.1) {\n label = 'Good';\n } else {\n label = 'Uncategorized';\n }\n\n return {\n json: {\n ...item.json,\n label,\n viewToSubRatio: ratio.toFixed(4)\n }\n };\n});\n"
},
"typeVersion": 2
},
{
"id": "2d5c7fe7-ae08-4919-937b-d089dcacb07a",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1080,
660
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "cffd4aad-67c7-405b-b1bf-816e93db3c01",
"name": "等待",
"type": "n8n-nodes-base.wait",
"position": [
2740,
960
],
"webhookId": "7f98e718-4009-410d-8039-6ef89e198c97",
"parameters": {
"amount": 2
},
"typeVersion": 1.1
},
{
"id": "92302dac-6e31-46a6-8740-820f15c41541",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1020,
180
],
"parameters": {
"width": 700,
"height": 1280,
"content": "# 🔍 YouTube 热门视频研究工作流 📈 — 批量视频分析助力热门内容发现!"
},
"typeVersion": 1
},
{
"id": "e0e91135-4c24-4566-8eb2-4d23fc133b1c",
"name": "设置您的密钥",
"type": "n8n-nodes-base.set",
"position": [
20,
440
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e04aa951-a569-4adc-ae0f-727e5b678ed9",
"name": "api_key",
"type": "string",
"value": "<api-key>"
},
{
"id": "490f5e38-e3eb-463e-8716-9ac1f92651c8",
"name": "search_term",
"type": "string",
"value": "={{ $json[\"Share your idea?\"] }}"
},
{
"id": "69b72b2f-6edc-4a00-b4e9-3e72a48e1322",
"name": "format",
"type": "string",
"value": "={{ $json.Format }}"
},
{
"id": "545e6c23-0b63-4461-b9e2-dd8ff1fd00bd",
"name": "videoLimit",
"type": "string",
"value": "={{ $json[\"Number of Videos\"] }}"
}
]
}
},
"typeVersion": 3.4
}
],
"pinData": {},
"connections": {
"Code": {
"main": [
[
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Extract IDs": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Channel Data": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Set you keys": {
"main": [
[
{
"node": "Get Video IDs",
"type": "main",
"index": 0
}
]
]
},
"Get Video IDs": {
"main": [
[
{
"node": "Extract IDs",
"type": "main",
"index": 0
}
]
]
},
"Get Video Data": {
"main": [
[
{
"node": "Extract Video Data",
"type": "main",
"index": 0
},
{
"node": "Get Channel Statistics",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Get Video Data",
"type": "main",
"index": 0
}
]
]
},
"Video Performance": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Extract Video Data": {
"main": [
[
{
"node": "Video Performance",
"type": "main",
"index": 0
}
]
]
},
"On form submission": {
"main": [
[
{
"node": "Set you keys",
"type": "main",
"index": 0
}
]
]
},
"Append row in sheet": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Get Channel Statistics": {
"main": [
[
{
"node": "Channel Data",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 市场调研
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
我的工作流11
通过RapidAPI批量导出亚马逊产品评论到Google Sheets
If
Set
Code
+7
11 节点Hunyao
市场调研
选题捕手模板
使用Gemini分析Reddit、YouTube和X生成内容策略报告
If
Set
Code
+14
34 节点Sheryl
市场调研
潜在客户开发与邮件工作流
使用Google Maps、SendGrid和AI自动化B2B潜在客户开发与邮件营销
If
Set
Code
+21
141 节点Ezema Kingsley Chibuzo
潜在客户开发
WordPress博客自动化专业版(深度研究)v2.1市场
使用GPT-4o、Perplexity AI和多语言支持自动化SEO优化的博客创建
If
Set
Xml
+27
125 节点Daniel Ng
内容创作
使用 OpenAI、ElevenLabs 和 Fal.ai 自动化病毒式内容创作,适用于视频、播客和 ASMR
使用 OpenAI、ElevenLabs 和 Fal.ai 自动化病毒式内容创作,适用于视频、播客和 ASMR
Set
Code
Wait
+16
97 节点Adam Crafts
内容创作
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
工作流信息
难度等级
高级
节点数量22
分类1
节点类型9
作者
Akash Kankariya
@akash25I'm a developer with 5 years of experience in Python and Node.js. Over the past year, I've been building workflows to streamline operations for my team. I have also developed RAG chatbots, AI agents, and WhatsApp automation. If you need any help with N8N workflows, let's connect over a call and solve it together!
外部链接
在 n8n.io 查看 →
分享此工作流