YouTube 爬虫
高级
这是一个Market Research领域的自动化工作流,包含 21 个节点。主要使用 Set, Sort, Wait, Limit, Filter 等节点。 通过自动筛选与相关性评分,将优质YouTube视频保存至Google表格
前置要求
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
使用的节点 (21)
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "uFO3zp2bl5cqZqMS",
"meta": {
"instanceId": "159ec2e1d690fe685084d28de8ca73848642bf563457a19b94cfc00f23a0d9a9",
"templateCredsSetupCompleted": true
},
"name": "YouTube 爬虫",
"tags": [],
"nodes": [
{
"id": "230d2269-6b2e-4915-82e8-b42c2a36746a",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
20,
-40
],
"parameters": {},
"typeVersion": 1
},
{
"id": "2ffb8769-8769-4636-adff-f70a65df8fa5",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
860,
140
],
"parameters": {
"color": 4,
"width": 340,
"height": 440,
"content": "此步骤将调用 YouTube 的 API,并要求其返回与查询匹配的视频,仅在教育类别中搜索,按相关性排序,且不超过 50 个。"
},
"typeVersion": 1
},
{
"id": "b0becf14-1e2b-47a4-83b0-2db297518479",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
220,
140
],
"parameters": {
"width": 340,
"height": 240,
"content": "此步骤将设置您要在 YouTube 中搜索的内容的值。这是可选的,但更容易更新,如果您想在节点外部更新它,可以附加一个聊天到此。"
},
"typeVersion": 1
},
{
"id": "d437a506-e2b8-48fa-98cf-940657d7a879",
"name": "设置查询",
"type": "n8n-nodes-base.set",
"position": [
340,
-40
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "58609f1a-03c7-4e5a-8199-2fcdaf495325",
"name": "query",
"type": "array",
"value": "={{[\n\"AI agents tutorial step by step\",\n\"AI tools tutorial for beginners\",\n\"AI agent building tutorial\",\n\"AI prompt engineering techniques\",\n\"best AI tools training\",\n\"prompt engineering best practices\"]}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ea7e2dad-4f8f-40d8-9e77-25fbfe222f6f",
"name": "搜索 YouTube",
"type": "n8n-nodes-base.httpRequest",
"position": [
980,
-40
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/search",
"options": {},
"sendQuery": true,
"authentication": "predefinedCredentialType",
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "id,snippet"
},
{
"name": "q",
"value": "={{ $json.query }}"
},
{
"name": "type",
"value": "video"
},
{
"name": "maxResults",
"value": "50"
},
{
"name": "order",
"value": "relevance"
},
{
"name": "videoCategoryId",
"value": "27"
}
]
},
"nodeCredentialType": "youTubeOAuth2Api"
},
"credentials": {
"youTubeOAuth2Api": {
"id": "kheqATZudwItRKpl",
"name": "YouTube account"
}
},
"typeVersion": 4.2
},
{
"id": "f68554af-5f38-4296-a38e-e917dba605f4",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1980,
220
],
"parameters": {
"color": 3,
"width": 440,
"height": 340,
"content": "此循环将收集我们从视频中需要的所有元数据,例如观看次数和点赞数,然后根据这些值以及发布时间的新近度进行过滤。最后,在发送到工作流的最终步骤之前,它将删除不必要的字段。"
},
"typeVersion": 1
},
{
"id": "62956d67-ee59-4131-8f4f-de263dafa7bc",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1380,
-320
],
"parameters": {
"color": 5,
"width": 340,
"height": 220,
"content": "此步骤将是第一个质量和相关性过滤器,排除任何看起来不纯粹是教育性的内容,或者看起来是推广性或欺诈性的内容。"
},
"typeVersion": 1
},
{
"id": "c0f112d7-99d3-487a-9def-71bf8a879fdd",
"name": "等待",
"type": "n8n-nodes-base.wait",
"position": [
2920,
-340
],
"webhookId": "4318003c-dba4-43fb-a918-3225868d358a",
"parameters": {
"amount": 3
},
"typeVersion": 1.1
},
{
"id": "43bb3d2b-0022-4cb0-a13c-ba7df4d4d9f4",
"name": "质量过滤",
"type": "n8n-nodes-base.filter",
"position": [
2280,
-40
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "0fe9a82c-6c5c-44c1-8da7-24e2f8783a0e",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.items[0].statistics.viewCount }}",
"rightValue": 10000
},
{
"id": "7eae8c9b-c85d-4f0f-92bd-01b047e05d0e",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.items[0].statistics.likeCount }}",
"rightValue": 100
},
{
"id": "51d609d3-0b04-476e-9abd-a68a1f9c095c",
"operator": {
"type": "dateTime",
"operation": "after"
},
"leftValue": "={{ $json.items[0].snippet.publishedAt }}",
"rightValue": "2023-12-01T00:00:00"
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "f844dd50-6a38-4e9f-874b-885bddf52b4e",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
2260,
-820
],
"parameters": {
"color": 3,
"width": 440,
"height": 440,
"content": "这最后一系列步骤将删除重复视频,根据关键词和质量指标分配相关性分数,然后仅将排名靠前的视频发送到 Google 表格。"
},
"typeVersion": 1
},
{
"id": "40ec5dda-3c74-4203-b769-896cdb17c703",
"name": "分割查询",
"type": "n8n-nodes-base.splitOut",
"position": [
660,
-40
],
"parameters": {
"options": {},
"fieldToSplitOut": "query"
},
"typeVersion": 1
},
{
"id": "0f3f6e07-b0ad-4558-a268-97b61094671a",
"name": "分割结果",
"type": "n8n-nodes-base.splitOut",
"position": [
1240,
-40
],
"parameters": {
"options": {},
"fieldToSplitOut": "items"
},
"typeVersion": 1
},
{
"id": "c44d4550-3bcc-46e5-b294-65c5455b112f",
"name": "相关性过滤",
"type": "n8n-nodes-base.filter",
"position": [
1480,
-40
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "051c8268-ace1-4d87-a57e-798ed9992331",
"operator": {
"type": "string",
"operation": "regex"
},
"leftValue": "={{ $json.snippet.title.toLowerCase() }}",
"rightValue": "tutorial|course|guide|training|learn|education|explained|masterclass|complete.*guide|step.*by.*step|beginners.*guide|how.*to.*build|fundamentals"
},
{
"id": "3bb11116-7ac6-4aa1-b1ac-3ebd1a6ceb82",
"operator": {
"type": "string",
"operation": "notRegex"
},
"leftValue": "={{ $json.snippet.title.toLowerCase() }}",
"rightValue": "money|rich|profit|earn|cash|income|\\$|💰|sell|agency|business|client|freelance|side.*hustle|make.*money"
},
{
"id": "5edc6bdd-514c-4cbd-bbbc-51da2f87c41e",
"operator": {
"type": "string",
"operation": "notRegex"
},
"leftValue": "={{ $json.snippet.title.toLowerCase() }}",
"rightValue": "autopilot|passive.*income|[\\d]+k.*subs|faceless.*videos|youtube.*automation.*money|100%.*automated.*money"
},
{
"id": "320ed472-8b8d-49bc-b830-e95c39017397",
"operator": {
"type": "string",
"operation": "notRegex"
},
"leftValue": "={{ $json.snippet.title.toLowerCase() }}",
"rightValue": "insane|crazy|ultimate.*secret|hack|trick|must.*do|steal.*these|best.*way.*to.*make|ways.*to.*make|you.*need.*to|[\\d]+.*ways|[\\d]+.*insane"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "74f3670e-e61a-4dd1-bde7-5fbf845e14ca",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1820,
-80
],
"parameters": {
"options": {},
"batchSize": 10
},
"executeOnce": false,
"typeVersion": 3,
"alwaysOutputData": false
},
{
"id": "8ad9d1d8-83f7-4edc-bac3-3d7bffbc0c83",
"name": "获取视频元数据",
"type": "n8n-nodes-base.httpRequest",
"position": [
2060,
-40
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/videos",
"options": {},
"sendQuery": true,
"authentication": "predefinedCredentialType",
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet,statistics"
},
{
"name": "id",
"value": "={{ $json.id.videoId }}"
}
]
},
"nodeCredentialType": "youTubeOAuth2Api"
},
"credentials": {
"youTubeOAuth2Api": {
"id": "kheqATZudwItRKpl",
"name": "YouTube account"
}
},
"typeVersion": 4.2
},
{
"id": "040a4ed8-ec93-4461-acc1-5403154d3d61",
"name": "删除不必要字段",
"type": "n8n-nodes-base.set",
"position": [
2480,
-40
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "bd1dfa28-997f-45e7-983f-06b4afdf2224",
"name": "Title",
"type": "string",
"value": "={{ $json.items[0].snippet.title }}"
},
{
"id": "9921ef02-a86d-42ae-a4df-9c2dd674505c",
"name": "Channel",
"type": "string",
"value": "={{ $json.items[0].snippet.channelTitle }}"
},
{
"id": "ec38edef-66e2-480f-9617-66123decfcef",
"name": "Published At",
"type": "string",
"value": "={{ $json.items[0].snippet.publishedAt }}"
},
{
"id": "9bb69372-553a-4c8d-8286-00f41c90a78c",
"name": "Views",
"type": "string",
"value": "={{ $json.items[0].statistics.viewCount }}"
},
{
"id": "80edec74-08c1-4d68-82f7-ba061cb2173e",
"name": "Likes",
"type": "string",
"value": "={{ $json.items[0].statistics.likeCount }}"
},
{
"id": "9700bbee-7f25-43fe-a653-42a7c8fade77",
"name": "Description",
"type": "string",
"value": "={{ $json.items[0].snippet.description }}"
},
{
"id": "9afaaa69-1afd-4f45-bfe6-24671651ac82",
"name": "URL",
"type": "string",
"value": "=https://www.youtube.com/watch?v={{ $json.items[0].id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "79b34b24-290f-43b7-8c45-990a5c30cdb0",
"name": "删除重复视频",
"type": "n8n-nodes-base.removeDuplicates",
"position": [
2060,
-340
],
"parameters": {
"compare": "={{ $json.URL }}",
"options": {}
},
"typeVersion": 2
},
{
"id": "756fa598-ab05-46ff-aaea-be6c9533568d",
"name": "生成相关性分数",
"type": "n8n-nodes-base.set",
"position": [
2280,
-340
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "d691e3bf-9fc4-406f-b6e7-d62487820ea1",
"name": "RelevanceScore",
"type": "number",
"value": "={{\n // Educational keywords (higher scores)\n (($json.Title.toLowerCase().includes('tutorial')) ? 15 : 0) +\n (($json.Title.toLowerCase().includes('course')) ? 15 : 0) +\n (($json.Title.toLowerCase().includes('guide')) ? 12 : 0) +\n (($json.Title.toLowerCase().includes('explained')) ? 12 : 0) +\n (($json.Title.toLowerCase().includes('beginner')) ? 10 : 0) +\n (($json.Title.toLowerCase().includes('step by step')) ? 15 : 0) +\n (($json.Title.toLowerCase().includes('complete')) ? 10 : 0) +\n \n // AI-specific terms\n (($json.Title.toLowerCase().includes('prompt engineering')) ? 20 : 0) +\n (($json.Title.toLowerCase().includes('ai agent')) ? 18 : 0) +\n (($json.Title.toLowerCase().includes('ai tools')) ? 15 : 0) +\n (($json.Title.toLowerCase().includes('prompting')) ? 15 : 0) +\n \n // Quality indicators\n ((parseInt($json.Views) > 100000) ? 10 : 0) +\n ((parseInt($json.Views) > 50000) ? 5 : 0) +\n ((parseInt($json.Likes) > 1000) ? 8 : 0) +\n \n // Penalty for monetization indicators\n (($json.Title.toLowerCase().includes('money') || \n $json.Title.toLowerCase().includes('rich') || \n $json.Title.toLowerCase().includes('earn')) ? -20 : 0)\n}}"
},
{
"id": "a9e446de-dc9c-4dba-ab0b-d5647a24ba39",
"name": "Title",
"type": "string",
"value": "={{ $json.Title }}"
},
{
"id": "1669b129-9e9a-45e6-925f-c5e41e6de692",
"name": "Channel",
"type": "string",
"value": "={{ $json.Channel }}"
},
{
"id": "3d45d0ce-3068-424c-80a3-06c11785846d",
"name": "Published at",
"type": "string",
"value": "={{ $json['Published At'] }}"
},
{
"id": "16e45f2b-1d0b-48e4-b86c-7e8ba82c5aef",
"name": "Views",
"type": "string",
"value": "={{ $json.Views }}"
},
{
"id": "86f2af64-27f9-4e3c-9883-c279edc938c6",
"name": "Likes",
"type": "string",
"value": "={{ $json.Likes }}"
},
{
"id": "d967b6c4-ab40-4f87-a84e-e0cb1bbb51d6",
"name": "Descriptoin",
"type": "string",
"value": "={{ $json.Description }}"
},
{
"id": "e0af7129-2215-4583-b236-63587a4974b6",
"name": "URL",
"type": "string",
"value": "={{ $json.URL }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "452016d9-50ce-49bb-bed8-d3213bd5bcec",
"name": "按相关性排序",
"type": "n8n-nodes-base.sort",
"position": [
2480,
-340
],
"parameters": {
"options": {
"disableDotNotation": false
},
"sortFieldsUi": {
"sortField": [
{
"order": "descending",
"fieldName": "RelevanceScore"
}
]
}
},
"typeVersion": 1
},
{
"id": "916ff54f-b7a3-472f-af8e-df2e501aef65",
"name": "强制限制",
"type": "n8n-nodes-base.limit",
"position": [
2700,
-340
],
"parameters": {
"maxItems": 50
},
"typeVersion": 1
},
{
"id": "b4007c9b-cf09-4292-b22d-2778bf7c03a6",
"name": "发送到 Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
3120,
-340
],
"parameters": {
"columns": {
"value": {
"URL": "={{ $json.URL }}",
"Likes": "={{ $json.Likes }}",
"Title": "={{ $json.Title }}",
"Views": "={{ $json.Views }}",
"Channel": "={{ $json.Channel }}",
"Description": "={{ $json.Descriptoin }}",
"Published At": "={{ $json['Published at'] }}"
},
"schema": [
{
"id": "Title",
"type": "string",
"display": true,
"required": false,
"displayName": "Title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Channel",
"type": "string",
"display": true,
"required": false,
"displayName": "Channel",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Published At",
"type": "string",
"display": true,
"required": false,
"displayName": "Published At",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Views",
"type": "string",
"display": true,
"required": false,
"displayName": "Views",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Likes",
"type": "string",
"display": true,
"required": false,
"displayName": "Likes",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Description",
"type": "string",
"display": true,
"required": false,
"displayName": "Description",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "URL",
"type": "string",
"display": true,
"required": false,
"displayName": "URL",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LbV3_SHHrGiTm7h-4WjBlbaNXDcv7fzzvHhmrU_GY3c/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1LbV3_SHHrGiTm7h-4WjBlbaNXDcv7fzzvHhmrU_GY3c",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1LbV3_SHHrGiTm7h-4WjBlbaNXDcv7fzzvHhmrU_GY3c/edit?usp=drivesdk",
"cachedResultName": "YouTube AI Resources"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "e6dWze7VEM4F98dD",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "cfed5f6c-f15f-4dfe-bf4a-11541a75fc71",
"connections": {
"Wait": {
"main": [
[
{
"node": "Send to Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Set Query": {
"main": [
[
{
"node": "Split Query",
"type": "main",
"index": 0
}
]
]
},
"Force Limit": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Split Query": {
"main": [
[
{
"node": "Search YouTube",
"type": "main",
"index": 0
}
]
]
},
"Split Results": {
"main": [
[
{
"node": "Filter for Relevance",
"type": "main",
"index": 0
}
]
]
},
"Search YouTube": {
"main": [
[
{
"node": "Split Results",
"type": "main",
"index": 0
}
]
]
},
"Loop over Items": {
"main": [
[
{
"node": "Remove Duplicate Videos",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Video Metadata",
"type": "main",
"index": 0
}
]
]
},
"Sort by Relevance": {
"main": [
[
{
"node": "Force Limit",
"type": "main",
"index": 0
}
]
]
},
"Filter for Quality": {
"main": [
[
{
"node": "Remove Unnecessary Fields",
"type": "main",
"index": 0
}
]
]
},
"Get Video Metadata": {
"main": [
[
{
"node": "Filter for Quality",
"type": "main",
"index": 0
}
]
]
},
"Filter for Relevance": {
"main": [
[
{
"node": "Loop over Items",
"type": "main",
"index": 0
}
]
]
},
"Send to Google Sheets": {
"main": [
[]
]
},
"Remove Duplicate Videos": {
"main": [
[
{
"node": "Generate Relevance Score",
"type": "main",
"index": 0
}
]
]
},
"Generate Relevance Score": {
"main": [
[
{
"node": "Sort by Relevance",
"type": "main",
"index": 0
}
]
]
},
"Remove Unnecessary Fields": {
"main": [
[
{
"node": "Loop over Items",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Set Query",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 市场调研
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
使用Google Maps生成潜在客户 - AlexK1919
使用Google Maps生成潜在客户
If
Set
Code
+13
42 节点Alex Kim
销售
源发现 - 自动搜索更及时的信息源
多平台源发现系统,集成 SerpAPI、DuckDuckGo、GitHub、Reddit 和 Bluesky
Set
Code
Limit
+18
68 节点Hybroht
市场调研
API架构提取器
API架构提取器
If
Set
Code
+22
88 节点Polina Medvedieva
工程
抓取Meta广告库并使用Gemini分析视频广告,将数据存储到Google Sheets
使用Gemini分析Meta广告库视频广告,并将结果存储到Google Sheets
Set
Code
Sort
+11
24 节点Daniel Setzermann
人工智能
潜在客户开发与邮件工作流
使用Google Maps、SendGrid和AI自动化B2B潜在客户开发与邮件营销
If
Set
Code
+21
141 节点Ezema Kingsley Chibuzo
潜在客户开发
工作流信息
难度等级
高级
节点数量21
分类1
节点类型12
作者
Zach @BrightWayAI
@ajentaI’m Zach, founder of BrightWay and long-time product leader turned AI builder. I’ve led product teams at high-growth companies and now focus on helping mission-driven organizations automate repetitive tasks with n8n and AI. I believe in making automation accessible, starting small, and solving real-world problems with simple, smart systems.
外部链接
在 n8n.io 查看 →
分享此工作流