YouTube 趋势发现器
高级
这是一个Market Research, Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 If, Set, Code, Form, YouTube 等节点。 YouTube 趋势发现助手
前置要求
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "SYrpMRFFGu2Y96eE",
"meta": {
"instanceId": "061ca141d020a6e1355b8c7fe05f92a699e37e92079ad2e150a506ee8bbe9e11"
},
"name": "YouTube 趋势发现器",
"tags": [],
"nodes": [
{
"id": "c3c3a2c0-e066-4e6f-94d3-54d10c72b588",
"name": "获取多个视频",
"type": "n8n-nodes-base.youTube",
"position": [
-1104,
176
],
"parameters": {
"filters": {
"q": "={{ $('On form submission').item.json['Topic Name'] }}",
"regionCode": "US",
"publishedAfter": "={{ $('Edit Fields').item.json[\"Published After\"] }}"
},
"options": {
"order": "relevance",
"safeSearch": "moderate"
},
"resource": "video",
"returnAll": true
},
"typeVersion": 1
},
{
"id": "a6f66df7-33f7-44c6-90a0-2cc050d59561",
"name": "表单提交时",
"type": "n8n-nodes-base.formTrigger",
"position": [
-1616,
176
],
"webhookId": "b29d3aa8-6546-4971-9326-918ff3a3f4a6",
"parameters": {
"options": {},
"formTitle": "Find YT Trends in Your Niche",
"formFields": {
"values": [
{
"fieldLabel": "Topic Name",
"requiredField": true
},
{
"fieldType": "number",
"fieldLabel": "Last How Many Days?",
"requiredField": true
}
]
},
"responseMode": "lastNode",
"formDescription": "Put the Niche Name and Get The Trends"
},
"typeVersion": 2.2
},
{
"id": "f6d8d02b-2f65-4eb8-96f9-e5d3162b4a1e",
"name": "编辑字段",
"type": "n8n-nodes-base.set",
"position": [
-1456,
176
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c4122b37-8a0e-4cc6-aa0d-c43e6eecd97f",
"name": "Published After",
"type": "string",
"value": "={{ $today.minus({days: $json['Last How Many Days?']}).toFormat('yyyy-MM-dd\\'T\\'HH:mm:ss') }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3da1c044-113a-453a-9b06-bba96172b040",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
-736,
176
],
"parameters": {
"jsCode": "const items = $input.all();\n\nconst engagementRates = items.map((item) => {\n const video = item.json.items?.[0];\n const stats = video?.statistics || {};\n\n const likeCount = parseInt(stats.likeCount || 0, 10);\n const commentCount = parseInt(stats.commentCount || 0, 10);\n const viewCount = parseInt(stats.viewCount || 0, 10);\n\n let engagementRate = 0;\n if (viewCount > 0) {\n engagementRate = ((likeCount + commentCount) / viewCount) * 100;\n }\n\n return {\n json: {\n id: video?.id || null,\n title: video?.snippet?.title || null,\n engagementRate: engagementRate.toFixed(2),\n viewCount,\n likeCount,\n commentCount\n }\n };\n});\n\nreturn engagementRates;\n"
},
"typeVersion": 2
},
{
"id": "0c8ea224-c476-4c92-8177-8d3016961057",
"name": "无操作,不执行任何动作",
"type": "n8n-nodes-base.noOp",
"position": [
-384,
352
],
"parameters": {},
"typeVersion": 1
},
{
"id": "01f702ce-2284-4a60-a1b9-4741ee60c45c",
"name": "创建电子表格",
"type": "n8n-nodes-base.googleSheets",
"position": [
-1280,
176
],
"parameters": {
"title": "=Trending YouTube Videos on {{ $('On form submission').item.json['Topic Name'] }} in Last {{ $('On form submission').item.json['Last How Many Days?'] }} days",
"options": {},
"resource": "spreadsheet"
},
"typeVersion": 4.7
},
{
"id": "dddb8081-289f-4e9c-aa02-5294e6f97267",
"name": "在表格中追加行",
"type": "n8n-nodes-base.googleSheets",
"position": [
192,
0
],
"parameters": {
"columns": {
"value": {},
"schema": [
{
"id": "Video Title",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Video Title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Video URL",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Video URL",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Views",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Views",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Likes",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Likes",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Comments",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Comments",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Uploaded",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Uploaded",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "autoMapInputData",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {
"cellFormat": "USER_ENTERED"
},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TCVpJwGN_2oBrVXmtsdGOQgPxyvYSlyoC51sLu28mHk/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Create spreadsheet').item.json.spreadsheetId }}"
}
},
"typeVersion": 4.7
},
{
"id": "2dd50913-5321-48db-a2b8-bda94b9b3966",
"name": "表单",
"type": "n8n-nodes-base.form",
"position": [
544,
0
],
"webhookId": "faa830fb-63b6-42cc-812d-0d9974331f6a",
"parameters": {
"options": {},
"operation": "completion",
"completionTitle": "🤖 Here's Your Analytics Data 🔽",
"completionMessage": "={{ $json.OutPut }}"
},
"typeVersion": 1
},
{
"id": "266d7470-d1b5-4696-99d3-cc3fd0f8eb58",
"name": "无操作,什么都不做1",
"type": "n8n-nodes-base.noOp",
"position": [
0,
192
],
"parameters": {},
"typeVersion": 1
},
{
"id": "3159c4f3-4298-404b-a267-190e1ba10370",
"name": "获取数据",
"type": "n8n-nodes-base.httpRequest",
"position": [
-912,
176
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/videos?",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "key",
"value": "=Your Project API Key"
},
{
"name": "part",
"value": "contentDetails, snippet, statistics"
},
{
"name": "id",
"value": "={{ $json.id.videoId }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "aaf45b82-6f3b-4efa-858e-f3f511303457",
"name": "数据格式",
"type": "n8n-nodes-base.set",
"position": [
-384,
16
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4df5f7b5-9a62-4e56-89bd-5f32dea0afe5",
"name": "Video Title",
"type": "string",
"value": "={{ $json.title }}"
},
{
"id": "e95a1103-f1fd-45e7-99d6-5a345d63059b",
"name": "Video URL",
"type": "string",
"value": "=https://www.youtube.com/watch?v={{ $json.id }}"
},
{
"id": "c56731ba-aa34-4d77-ac4a-351023cfe307",
"name": "Engagement Rate",
"type": "string",
"value": "={{ $json.engagementRate }}"
},
{
"id": "9f3b4cf0-ac26-4e91-a57c-4642039a53ac",
"name": "Views",
"type": "string",
"value": "={{ $json.viewCount }}"
},
{
"id": "8c9098a1-942e-4545-bee0-9bbe8b896858",
"name": "Likes",
"type": "string",
"value": "={{ $json.likeCount }}"
},
{
"id": "4e3e4a3b-27f1-4eef-8bb8-68303753f9e1",
"name": "Comments",
"type": "string",
"value": "={{ $json.commentCount }}"
},
{
"id": "df17f506-d404-4fdd-afb1-0ee28e46acb9",
"name": "Uploaded Hours Ago",
"type": "string",
"value": "={{ (() => { const published = new Date($('Get Data').item.json.items[0].snippet.publishedAt); const now = new Date(); const diffMs = now - published; const diffHours = Math.floor(diffMs / (1000 * 60 * 60)); return diffHours; })() }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "1951fa3a-af44-4b4a-9bf0-64da6da127c3",
"name": "输出格式",
"type": "n8n-nodes-base.set",
"position": [
368,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "994aa092-5c08-466a-9628-bd59d05c10ad",
"name": "OutPut",
"type": "string",
"value": "=\nhttps://docs.google.com/spreadsheets/d/{{ $('Create spreadsheet').item.json.spreadsheetId }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f59b4bb6-68ba-4b45-bb8d-736477881bd2",
"name": "参与率检查",
"type": "n8n-nodes-base.if",
"position": [
-592,
176
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "7da3c1db-d75e-4b62-a78b-846d8e94a701",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "={{ $json.engagementRate }}",
"rightValue": 2
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "c0bb6380-f7c6-44d0-8207-2ce40a3adf9d",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
-240,
16
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "5c84431b-3683-4309-a1a8-d16613de2e5b",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.Views }}",
"rightValue": 1000
},
{
"id": "e810a539-4cd7-4603-b559-6e85e2fea8aa",
"operator": {
"type": "number",
"operation": "lte"
},
"leftValue": "={{ $json['Uploaded Hours Ago'] }}",
"rightValue": "={{ $('On form submission').item.json['Last How Many Days?'] * 24 }}"
},
{
"id": "246da16f-70c1-441f-990d-185a3a01834e",
"operator": {
"type": "string",
"operation": "notContains"
},
"leftValue": "={{ $json['Video Title'] }}",
"rightValue": "#"
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "95b5f253-1140-4dfd-b3a6-bb0c64abff20",
"name": "去除重复项",
"type": "n8n-nodes-base.removeDuplicates",
"position": [
0,
0
],
"parameters": {
"compare": "selectedFields",
"options": {},
"fieldsToCompare": "['Video URL']"
},
"typeVersion": 2
},
{
"id": "e26341d6-d21c-41ca-bfa1-21f7498d3b43",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1552,
-496
],
"parameters": {
"color": 6,
"width": 912,
"height": 576,
"content": "---"
},
"typeVersion": 1
},
{
"id": "15419c5b-5583-4204-8e7c-cec4a3290809",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-496
],
"parameters": {
"color": 6,
"width": 480,
"height": 464,
"content": "## 从这里开始:分步 YouTube 教程 :star:"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "254d16f7-3d61-4d3f-9628-f8ba8858ffd4",
"connections": {
"If": {
"main": [
[
{
"node": "Remove Duplicates",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing1",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Engagement Rate Check",
"type": "main",
"index": 0
}
]
]
},
"Get Data": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Data Format": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Create spreadsheet",
"type": "main",
"index": 0
}
]
]
},
"Output Format": {
"main": [
[
{
"node": "Form",
"type": "main",
"index": 0
}
]
]
},
"Get many videos": {
"main": [
[
{
"node": "Get Data",
"type": "main",
"index": 0
}
]
]
},
"Remove Duplicates": {
"main": [
[
{
"node": "Append row in sheet",
"type": "main",
"index": 0
}
]
]
},
"Create spreadsheet": {
"main": [
[
{
"node": "Get many videos",
"type": "main",
"index": 0
}
]
]
},
"On form submission": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Append row in sheet": {
"main": [
[
{
"node": "Output Format",
"type": "main",
"index": 0
}
]
]
},
"Engagement Rate Check": {
"main": [
[
{
"node": "Data Format",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 市场调研, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI潜在客户挖掘智能体
使用Apify、AI和Gmail的自动化潜在客户生成与冷邮件发送
If
Set
Wait
+11
20 节点Rakin Jakaria
潜在客户开发
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
求职申请代理
求职申请自动化代理
If
Form
Markdown
+9
15 节点Rakin Jakaria
多模态 AI
网站地图页面提取器
网站地图页面提取器:发现、清理并将网站 URL 保存至 Google Sheets
If
Set
Code
+6
19 节点Incrementors
市场调研
使用Google Sheets、Forms和Gmail通知自动化多步骤入职流程
使用Google Sheets、Forms和Gmail通知自动化多步骤入职流程
If
Set
Code
+11
31 节点PollupAI
人力资源
GLPI工单管理的用户友好技术支持门户
GLPI工单管理的用户友好技术支持门户
If
Set
Code
+6
25 节点Luis Hernandez
工单管理