8
n8n 中文网amn8n.com

使用 Gemini AI 分析 YouTube 视频并生成摘要

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 7 个节点。主要使用 Code, Form, FormTrigger, HttpRequest 等节点。 基于 Gemini AI 的 YouTube 视频内容分析与摘要生成器

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "7w2fAlYbwQEQL0hI",
  "meta": {
    "instanceId": "b9a4810a9a51f2cd27d6d88b2b57f7ecf9f947c4f003311c8382943a4b6c6dc4",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Gemini AI 分析 YouTube 视频并生成摘要",
  "tags": [],
  "nodes": [
    {
      "id": "86080cc2-d2fb-4901-8beb-76c6c736edba",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -208
      ],
      "parameters": {
        "color": 3,
        "width": 320,
        "height": 220,
        "content": "## 说明"
      },
      "typeVersion": 1
    },
    {
      "id": "42d3b4b8-67e6-4267-96a9-d44dc31af1ec",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -96
      ],
      "parameters": {
        "width": 1100,
        "height": 280,
        "content": "## 使用 Gemini AI 分析 YouTube 视频并生成摘要"
      },
      "typeVersion": 1
    },
    {
      "id": "7fc7e689-dab2-4341-a1c6-43053eebe8e1",
      "name": "获取输入",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -656,
        0
      ],
      "webhookId": "00f1dd2d-2e75-4f8e-b707-388308be0cfb",
      "parameters": {
        "options": {},
        "formTitle": "Analyze YouTube Videos and Generate Summaries with Gemini AI",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Video URL",
              "placeholder": "www.youtube",
              "requiredField": true
            },
            {
              "fieldLabel": "What do you want?",
              "placeholder": " Summarize in 3 sentences"
            }
          ]
        },
        "formDescription": "I'll analyze the contents of your YouTube video!\n"
      },
      "typeVersion": 2.2
    },
    {
      "id": "e8ad8180-5cae-499f-8c12-ddeb03c3bf09",
      "name": "检查描述是否为空",
      "type": "n8n-nodes-base.code",
      "notes": "If description is empty asign it the defoult prompt, else use the description given as the prompt to send to Google Gemini",
      "position": [
        -448,
        0
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  item.json.myNewField = 1;\n\n  if ($input.first().json['What u want?'].trim() == \"\") {\n    $input.first().json['What u want?'] = \"Please be as descriptive as possible about the contents being spoken of in this video after giving a detailed summary.\";\n}\n\n}\n\nreturn $input.all();\n// End of Code"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "8984a78e-7ab1-446a-8cbe-3d09c3a170f2",
      "name": "从 Google Gemini 获取分析",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -224,
        0
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"parts\": [\n        {\n          \"text\": \"{{ $json['What u want?'] }}\"\n        },\n        {\n          \"file_data\": {\n            \"file_uri\": \"{{ $json.Video }}\"\n          }\n        }\n      ]\n    }\n  ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "x-goog-api-key"
            }
          ]
        }
      },
      "notesInFlow": false,
      "typeVersion": 4.2
    },
    {
      "id": "10d568a8-1fd7-444e-ba61-be4aeaf3a188",
      "name": "分析结果",
      "type": "n8n-nodes-base.form",
      "position": [
        0,
        0
      ],
      "webhookId": "6432222b-3381-41cb-a42a-2f0d73537b98",
      "parameters": {
        "options": {
          "formTitle": "Analysis",
          "buttonLabel": "Another Analysis?",
          "formDescription": "={{ $json.candidates[0].content.parts[0].text }}"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c8acb7a2-9650-4f91-8a74-87317decf812",
      "name": "重定向进行另一项分析",
      "type": "n8n-nodes-base.form",
      "position": [
        224,
        0
      ],
      "webhookId": "b4ee5f3b-9d75-430b-8f02-93b1cecdd660",
      "parameters": {
        "operation": "completion",
        "redirectUrl": "=https://n8n.srv885623.hstgr.cloud/form/00f1dd2d-2e75-4f8e-b707-388308be0cfb",
        "respondWith": "redirect"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7d972248-7421-4ae0-a0fc-aed7d07a0f13",
  "connections": {
    "Get Input": {
      "main": [
        [
          {
            "node": "Check if description is empty",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analysis result": {
      "main": [
        [
          {
            "node": "Redirect for another analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if description is empty": {
      "main": [
        [
          {
            "node": "Get analysis from Google Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get analysis from Google Gemini": {
      "main": [
        [
          {
            "node": "Analysis result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量7
分类2
节点类型5
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Adrian Bent

Adrian Bent

@adrian-bent

Hey I'm Adrian. I got into automation to help me better understand and build systems. If you have any questions about my n8n templates/builds, feel free to ask, and I'll be happy to respond via email at terrflix45@gmail.com. Thanks for the time!

外部链接
在 n8n.io 查看

分享此工作流