YouTube 优化
中级
这是一个AI领域的自动化工作流,包含 12 个节点。主要使用 Code、Merge、Aggregate、HttpRequest、GoogleSheets 等节点,结合人工智能技术实现智能自动化。 YouTube 优化自动化:Google Sheets + DeepSeek 集成
前置要求
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "wSJzfPqFnJgQoet0",
"meta": {
"instanceId": "cd438fd1eca1b4215129611b59e2a783bbecd4a7fc04e24e9ac21de3d46ce6cc",
"templateCredsSetupCompleted": true
},
"name": "YouTube 优化",
"tags": [],
"nodes": [
{
"id": "c04d2583-25b6-4875-9bef-190d43b3ba55",
"name": "当点击\"执行工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
0,
0
],
"parameters": {},
"typeVersion": 1
},
{
"id": "12b1cb02-995c-490b-a1be-3f53831fa2ca",
"name": "获取表格中的行",
"type": "n8n-nodes-base.googleSheets",
"position": [
220,
0
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "Pending",
"lookupColumn": "Status"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 46645040,
"cachedResultUrl": "",
"cachedResultName": ""
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1zoIIfA03no9Q_huenS6qYrDFKdhrf1kFijDEHoiBZdk",
"cachedResultUrl": "",
"cachedResultName": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8697bDzanPk5JVnu",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "e58439a8-5add-4ff3-87cc-dfac283b8848",
"name": "HTTP 请求",
"type": "n8n-nodes-base.httpRequest",
"position": [
440,
0
],
"parameters": {
"url": "={{ $json.Url }}",
"options": {},
"jsonHeaders": "{\n \"User-Agent\": \"Mozilla/5.0\"\n}",
"sendHeaders": true,
"specifyHeaders": "json"
},
"typeVersion": 4.2
},
{
"id": "b2757b85-9256-43af-bd59-4455b30a5d88",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
660,
0
],
"parameters": {
"jsCode": "const html = $input.first().json.data;\n\n\nconst match = html.match(/var ytInitialData = (.*?);\\s*<\\/script>/s);\nif (!match) {\n return [{ json: { error: \"ytInitialData not found\" } }];\n}\n\nlet data;\ntry {\n data = JSON.parse(match[1]);\n} catch (err) {\n return [{ json: { error: \"Invalid JSON\", details: err.message } }];\n}\n\nlet title = null;\nlet description = null;\n\n\ntry {\n const contents = data.contents.twoColumnWatchNextResults.results.results.contents;\n const videoPrimaryInfo = contents.find(c => c.videoPrimaryInfoRenderer);\n title = videoPrimaryInfo.videoPrimaryInfoRenderer.title.runs[0].text;\n} catch (e) {\n title = null;\n}\n\n\nfunction findAttributedDescription(obj) {\n if (typeof obj !== 'object' || obj === null) return null;\n\n if (obj.attributedDescription && obj.attributedDescription.content) {\n return obj.attributedDescription.content;\n }\n\n for (const key in obj) {\n const result = findAttributedDescription(obj[key]);\n if (result) return result;\n }\n\n return null;\n}\n\ndescription = findAttributedDescription(data);\n\nreturn [{\n json: {\n title,\n description\n }\n}];"
},
"typeVersion": 2
},
{
"id": "d388f1a8-e92f-439b-8fdd-baeda842f703",
"name": "DeepSeek聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
"position": [
560,
220
],
"parameters": {
"options": {}
},
"credentials": {
"deepSeekApi": {
"id": "jPnyKkmqHRq5dXfZ",
"name": "DeepSeek account"
}
},
"typeVersion": 1
},
{
"id": "b8b37c7f-10ed-48e3-9681-74f1b4eabcc8",
"name": "合并",
"type": "n8n-nodes-base.merge",
"position": [
1400,
-20
],
"parameters": {
"numberInputs": 3
},
"typeVersion": 3.2
},
{
"id": "52da4d3e-48d6-4cd3-b52a-cd07a9d6df77",
"name": "在表格中更新行1",
"type": "n8n-nodes-base.googleSheets",
"position": [
1720,
-20
],
"parameters": {
"columns": {
"value": {
"Url": "={{ $('Get row(s) in sheet').item.json.Url }}",
"Etap": "=Done",
"New Title": "={{ $json.data[0].newTitle }}",
"Old Title": "={{ $json.data[2].title }}",
"New Description": "={{ $json.data[1].newDescription }}",
"Old Description": "={{ $json.data[2].description }}"
},
"schema": [
{
"id": "Url",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Url",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "keyword",
"type": "string",
"display": true,
"required": false,
"displayName": "keyword",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Status",
"type": "string",
"display": true,
"required": false,
"displayName": "Status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Old Title",
"type": "string",
"display": true,
"required": false,
"displayName": "Old Title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "New Title",
"type": "string",
"display": true,
"required": false,
"displayName": "New Title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Old Description",
"type": "string",
"display": true,
"required": false,
"displayName": "Old Description",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "New Description",
"type": "string",
"display": true,
"required": false,
"displayName": "New Description",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "All Keywords",
"type": "string",
"display": true,
"required": false,
"displayName": "All Keywords",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Url"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 46645040,
"cachedResultUrl": "",
"cachedResultName": ""
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1zoIIfA03no9Q_huenS6qYrDFKdhrf1kFijDEHoiBZdk",
"cachedResultUrl": "",
"cachedResultName": ""
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "8697bDzanPk5JVnu",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "1be2ad4b-c29a-43af-9ac5-24eee218aee6",
"name": "代码1",
"type": "n8n-nodes-base.code",
"position": [
1140,
0
],
"parameters": {
"jsCode": "\nconst rawText = items[0].json.text;\n\n\nconst parsed = JSON.parse(rawText);\n\n\nreturn [{ json: parsed }];"
},
"typeVersion": 2
},
{
"id": "ad7d912a-7cbc-4552-ad21-2a7ab1455c05",
"name": "代码2",
"type": "n8n-nodes-base.code",
"position": [
1140,
160
],
"parameters": {
"jsCode": "\nconst rawText = items[0].json.text;\n\n\nconst parsed = JSON.parse(rawText);\n\n\nreturn [{ json: parsed }];"
},
"typeVersion": 2
},
{
"id": "e7f50baa-570d-4426-b5ec-56ef0272bf20",
"name": "聚合",
"type": "n8n-nodes-base.aggregate",
"position": [
1540,
-20
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "6dc22bd3-93eb-4c00-b230-19981f12b7a1",
"name": "新标题生成",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
820,
0
],
"parameters": {
"text": "=You are a YouTube SEO and copywriting expert.\n\nI will give you:\n- the current (old) video title,\n- the main keyword we want to rank for.\n\nYour job is to rewrite the title to:\n1. Be **more attention-grabbing** (clickable / curiosity-driven),\n2. Include the **given keyword naturally** (for SEO),\n3. Stay relevant to the original title's topic,\n5. Use power words, numbers, questions, or hooks where possible.\n\nOutput only 3 optimized YouTube titles. Number them. Do not add anything else.\n\nOld title: \"{{ $json.title }}\"\nKeyword: \"{{ $('Get row(s) in sheet').item.json.keyword }}\"\n\nVery important: Output only a **valid single-line JSON** with a key called `newTitle`. Do not use markdown, do not include explanations, lists, or comments.\n\nFormat example:\n{\"newTitle\": \"...\"}",
"batching": {},
"messages": {
"messageValues": [
{
"message": "Very important: Output only a **valid single-line JSON** with a key called `newTitle`. Do not use markdown, do not include explanations, lists, or comments. Format example: {\"newTitle\": \"...\"}"
}
]
},
"promptType": "define"
},
"typeVersion": 1.7,
"alwaysOutputData": false
},
{
"id": "f19b8383-9fe4-4ae2-9c66-5743f734d3b8",
"name": "新描述生成",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
820,
160
],
"parameters": {
"text": "=You are an expert in YouTube SEO and copywriting.\n\nYour task is to rewrite a YouTube video description using the following inputs:\n- The **original description**\n- The **main keyword** we want to rank for\n\nInstructions:\n1. Keep the original **timeline section** exactly as it is (do not change order or content).\n2. Improve the rest of the description to:\n - Be more **engaging and persuasive** (increase watch time and clicks)\n - Naturally include the **given keyword** for better SEO\n - Encourage viewers to subscribe, comment, or check other content\n - Use line breaks, emojis (optionally), and formatting for readability\n3. Output the final version as plain text. Do not explain anything.\n4. The new description should be max 1500 characters if possible.\n\n---\n\nOriginal description:\n\"\"\"\n{{ $json.description }}\n\"\"\"\n\nKeyword: \"{{ $('Get row(s) in sheet').item.json.keyword }}\"\n\n Return in this JSON format:\n{\n \"newDescription\": \"...\"\n}",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.7
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "80a821b7-719c-4fc0-bed7-698c2f17dc5a",
"connections": {
"Code": {
"main": [
[
{
"node": "New Title Generating",
"type": "main",
"index": 0
},
{
"node": "New Description Generating",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Code2": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "Update row in sheet1",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"DeepSeek Chat Model": {
"ai_languageModel": [
[
{
"node": "New Title Generating",
"type": "ai_languageModel",
"index": 0
},
{
"node": "New Description Generating",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get row(s) in sheet": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"New Title Generating": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"New Description Generating": {
"main": [
[
{
"node": "Code2",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Get row(s) in sheet",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个中级难度的工作流,适用于AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
SEO审核
SEO站内审核
Code
Html
Merge
+6
25 节点Jacob
AI
自动化博客撰写与社交媒体推广代理
使用GPT-4、Perplexity和WordPress自动化SEO博客创建+社交媒体
Set
Code
Gmail
+21
79 节点LukaszB
Design
(Duc)深度研究市场模板
集成PerplexityAI研究和OpenAI内容的多层级WordPress博客生成器
If
Set
Xml
+28
132 节点Daniel Ng
AI
YouTube视频摘要生成器
使用Supadata转录、DeepSeek AI和Google Sheets总结YouTube视频
Code
Http Request
Google Sheets
+4
10 节点Jacob
Document Extraction
使用Bright Data和OpenAI的TrustPilot SaaS产品评论追踪器
使用Bright Data和OpenAI的TrustPilot SaaS产品评论追踪器
Set
Code
Merge
+11
22 节点Ranjan Dailata
Product
来自域名 - Perplexity、Linkedin、网站、Hunter、Airtop的B2B研究公司
AI潜在客户研究员:仅需公司名称和域名,集成ISCP
Set
Wait
Merge
+13
36 节点LukaszB
Sales