使用Google Gemini AI自动翻译YouTube视频内容
中级
这是一个自动化工作流,包含 14 个节点。主要使用 Set, Code, YouTube, HttpRequest, ManualTrigger 等节点。 使用Google Gemini AI自动翻译YouTube视频内容
前置要求
- •可能需要目标 API 的认证凭证
- •Google Gemini API Key
使用的节点 (14)
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "cea82d50bf3dfe55ffdf99f0a6e2d44598d750f6a131d04cff3d43ec88825599"
},
"nodes": [
{
"id": "42e836f4-219d-4ad7-9f01-aec4aedeaf25",
"name": "Google Gemini 聊天模型1",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-240,
0
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"id": "AuqgF9B5hGOJjyF4",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "7f95419d-4916-4aa5-9db4-0f65df350eb9",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-112,
0
],
"parameters": {
"sessionKey": "chat",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "7de516ce-cd4a-4628-b59e-30d1008f0e87",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
16,
0
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n\t\"title\": \"object\",\n \"description\": \"object\",\n \"tags\": \"object\"\n}"
},
"typeVersion": 1.3
},
{
"id": "a4033f3e-2c8b-4009-b298-c5ea8e6299b4",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-944,
-320
],
"parameters": {
"color": 7,
"width": 388,
"height": 304,
"content": "## 设置和检索信息"
},
"typeVersion": 1
},
{
"id": "b9dddc83-b3a2-4935-ae62-a39eb1af3864",
"name": "输出 URL",
"type": "n8n-nodes-base.set",
"position": [
448,
-224
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "ffd3b7ab-4ac6-4c71-8ee1-a6c93732a701",
"name": "URL",
"type": "string",
"value": "=https://studio.youtube.com/video/{{ $('Fetches video information').item.json.id }}/translations"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "c84d84a2-6093-436e-9a37-597331d917e0",
"name": "便签12",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1936,
-448
],
"parameters": {
"width": 678,
"height": 560,
"content": "## YouTube 视频标题和描述翻译器"
},
"typeVersion": 1
},
{
"id": "ffdab92b-7d0a-460d-a4a5-5929a8d4695c",
"name": "获取视频信息",
"type": "n8n-nodes-base.youTube",
"position": [
-704,
-224
],
"parameters": {
"options": {},
"videoId": "={{ $json.video }}",
"resource": "video",
"operation": "get"
},
"credentials": {
"youTubeOAuth2Api": {
"id": "B0GNbsQIpSj5OTsL",
"name": "YouTube Account - Mister Funable"
}
},
"typeVersion": 1
},
{
"id": "8ec32768-a9c3-4dfd-9b96-2b88f81fcaed",
"name": "检查要翻译的语言",
"type": "n8n-nodes-base.code",
"position": [
-464,
-224
],
"parameters": {
"jsCode": "// Get default language from the incoming item\nconst defaultLang = $input.first().json?.snippet?.defaultLanguage ?? 'en';\n\n// Get your mapping of name -> code from the node named: When clicking ‘Execute workflow’\nconst nameToCode = $('Defines Video ID and Languages').first().json.languages || {};\n\n// Build result excluding the default language\nconst entries = Object.entries(nameToCode).filter(([, code]) => code !== defaultLang);\n\nconst languages = entries.map(([name]) => name);\nconst keys = Object.fromEntries(entries);\n\n// Return a single item with the desired JSON\nreturn [\n {\n json: {\n defaultLang, // e.g. defaults to en\n languages, // e.g. [\"spanish\",\"japanese\"]\n keys // e.g. { spanish: \"es\", japanese: \"ja\" }\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "f513101f-9911-48d8-bd49-a5ddfbb8e00d",
"name": "AI Agent 翻译器",
"type": "@n8n/n8n-nodes-langchain.agent",
"maxTries": 2,
"position": [
-192,
-224
],
"parameters": {
"text": "=Translate the youtube video which has a default language of {{ $json.defaultLang }}, to {{ $json.languages }}.\n\nThis is the title: {{ $('Fetches video information').item.json.snippet.title }}\n\nand the description: {{ $('Fetches video information').item.json.snippet.description }}\n\nYou may suggest tags \n\nReturn only the translated languages in json format, with this structure:\n\n{\n \"LANGUAGE KEY 1\": { \"title\": \"Example\", \"description\": \"Example desc\" },\n \"LANGUAGE KEY 2\": { \"title\": \"Ejemplo\", \"description\": \"Desc Ejemplo\" },\n}",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"retryOnFail": true,
"typeVersion": 2.2,
"waitBetweenTries": 5000
},
{
"id": "9861fb97-a088-45e1-baad-2f3e4b0d52e0",
"name": "更新视频本地化",
"type": "n8n-nodes-base.httpRequest",
"position": [
208,
-224
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/videos?part=snippet,localizations",
"method": "PUT",
"options": {},
"jsonBody": "={{\n{\nid: $(\"Fetches video information\").item.json.id,\nsnippet: {\ndefaultLanguage: $('Check languages to translate').item.json.defaultLang,\ntitle: $('Fetches video information').item.json.snippet.title,\ndescription: $('Fetches video information').item.json.snippet.description,\ncategoryId: $('Fetches video information').item.json.snippet.categoryId,\ntags: $('Fetches video information').item.json.snippet.tags\n},\nlocalizations: $json.output\n}\n}}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"nodeCredentialType": "youTubeOAuth2Api"
},
"credentials": {
"youTubeOAuth2Api": {
"id": "B0GNbsQIpSj5OTsL",
"name": "YouTube Account - Mister Funable"
}
},
"typeVersion": 4.2
},
{
"id": "2d36fc0b-bd82-4b8a-a6c1-1a78d3e499e9",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-528,
-320
],
"parameters": {
"color": 7,
"width": 628,
"height": 304,
"content": "## 语言翻译"
},
"typeVersion": 1
},
{
"id": "11660cdc-4c28-4ecd-9898-684010a5bbd7",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
-320
],
"parameters": {
"color": 7,
"width": 580,
"height": 304,
"content": "## 更新本地化并返回 YouTube URL"
},
"typeVersion": 1
},
{
"id": "93132f37-61eb-4de7-9e75-d9703b95c486",
"name": "当点击“执行工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1120,
-224
],
"parameters": {},
"typeVersion": 1
},
{
"id": "b538cca6-dead-408f-9648-b2683099b345",
"name": "定义视频 ID 和语言",
"type": "n8n-nodes-base.set",
"position": [
-896,
-224
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"video\": \"REPLACEME\",\n \"languages\": {\n \"english\": \"en\",\n \"spanish\": \"es-419\",\n \"japanese\": \"ja\"\n }\n}\n",
"includeOtherFields": true
},
"typeVersion": 3.4
}
],
"pinData": {},
"connections": {
"7f95419d-4916-4aa5-9db4-0f65df350eb9": {
"ai_memory": [
[
{
"node": "f513101f-9911-48d8-bd49-a5ddfbb8e00d",
"type": "ai_memory",
"index": 0
}
]
]
},
"f513101f-9911-48d8-bd49-a5ddfbb8e00d": {
"main": [
[
{
"node": "9861fb97-a088-45e1-baad-2f3e4b0d52e0",
"type": "main",
"index": 0
}
]
]
},
"7de516ce-cd4a-4628-b59e-30d1008f0e87": {
"ai_outputParser": [
[
{
"node": "f513101f-9911-48d8-bd49-a5ddfbb8e00d",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"ffdab92b-7d0a-460d-a4a5-5929a8d4695c": {
"main": [
[
{
"node": "8ec32768-a9c3-4dfd-9b96-2b88f81fcaed",
"type": "main",
"index": 0
}
]
]
},
"42e836f4-219d-4ad7-9f01-aec4aedeaf25": {
"ai_languageModel": [
[
{
"node": "f513101f-9911-48d8-bd49-a5ddfbb8e00d",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"9861fb97-a088-45e1-baad-2f3e4b0d52e0": {
"main": [
[
{
"node": "b9dddc83-b3a2-4935-ae62-a39eb1af3864",
"type": "main",
"index": 0
}
]
]
},
"8ec32768-a9c3-4dfd-9b96-2b88f81fcaed": {
"main": [
[
{
"node": "f513101f-9911-48d8-bd49-a5ddfbb8e00d",
"type": "main",
"index": 0
}
]
]
},
"b538cca6-dead-408f-9648-b2683099b345": {
"main": [
[
{
"node": "ffdab92b-7d0a-460d-a4a5-5929a8d4695c",
"type": "main",
"index": 0
}
]
]
},
"93132f37-61eb-4de7-9e75-d9703b95c486": {
"main": [
[
{
"node": "b538cca6-dead-408f-9648-b2683099b345",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+
If
Ftp
Set
113 节点I versus AI
其他
实时 - 使用Gemini和Creatomate自动化病毒式AI视频制作与发布
使用Gemini和Creatomate自动化AI视频创作与多平台发布
Set
Code
Wait
+
Set
Code
Wait
47 节点Intuz
内容创作
⚡AI驱动的YouTube播放列表和视频摘要与分析v2
AI YouTube播放列表与视频分析聊天机器人
If
Set
Code
+
If
Set
Code
72 节点dmr
其他
基于AI的YouTube元数据生成器(GPT-4o、Gemini与内容增强)
基于AI的YouTube元数据生成器(GPT-4o、Gemini与内容增强)
Set
Xml
Code
+
Set
Xml
Code
37 节点Amjid Ali
人工智能
抓取Meta广告库并使用Gemini分析视频广告,将数据存储到Google Sheets
使用Gemini分析Meta广告库视频广告,并将结果存储到Google Sheets
Set
Code
Sort
+
Set
Code
Sort
24 节点Daniel Setzermann
人工智能
Arunava的多智能体智能Reddit自动化
使用AI品牌提及和Baserow跟踪自动评论Reddit帖子
If
Set
Code
+
If
Set
Code
35 节点Arunava
社交媒体