8
n8n 中文网amn8n.com

我的工作流程

高级

这是一个Content Creation, AI Summarization领域的自动化工作流,包含 16 个节点。主要使用 Set, Code, GoogleDocs, FormTrigger, HttpRequest 等节点。 使用Google Gemini和Google Docs总结任意语言的YouTube转录文本

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "e9QKXG6OxvBeE8MA",
  "meta": {
    "instanceId": "e634e668fe1fc93a75c4f2a7fc0dad807ca318b79654157eadb9578496acbc76",
    "templateCredsSetupCompleted": true
  },
  "name": "我的工作流程",
  "tags": [],
  "nodes": [
    {
      "id": "98d6c238-8ab3-4814-8b95-cc9e201e9e0a",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "10986afd-5943-4e72-9078-074e5191d7ac",
      "parameters": {
        "options": {},
        "formTitle": "summarize youtube videos from transcript for social media",
        "formFields": {
          "values": [
            {
              "fieldLabel": "videoUrl",
              "placeholder": "full video url",
              "requiredField": true
            },
            {
              "fieldLabel": "language",
              "placeholder": "English",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d9076f8d-d9cd-47da-832c-2ed605675779",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2540,
        460
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "O7BVBUVX5NSai6UC",
          "name": "Google Gemini(PaLM) Api account 4"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2f2e8e76-6666-441a-854f-0d108a8f26d1",
      "name": "Google 文档",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        3460,
        -140
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $json.summary }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "",
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "myMHSWYgGOTcSwsg",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ab9dd3f4-f2aa-4d9f-aef7-72420a1e53f8",
      "name": "映射器",
      "type": "n8n-nodes-base.set",
      "position": [
        420,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a2486ac7-c29c-419e-9cfc-753701723510",
              "name": "videoUrl",
              "type": "string",
              "value": "={{ $json.videoUrl }}"
            },
            {
              "id": "8032743b-0266-488b-83f3-d0a42f35c1e0",
              "name": "language",
              "type": "string",
              "value": "={{ $json.language }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ca6d25dd-0950-4ef2-9b2d-2f105d72fb35",
      "name": "格式化器",
      "type": "n8n-nodes-base.code",
      "position": [
        1580,
        20
      ],
      "parameters": {
        "jsCode": "const rawArray = $input.first().json.data;\n\nconsole.log(\"Raw Array Data:\", rawArray); // Log the raw input data\n\n// Step 1: Parse the outer JSON to access the inner data\nlet parsedData;\ntry {\n  parsedData = JSON.parse(rawArray);\n  console.log(\"Parsed Data:\", parsedData); // Log the parsed data\n} catch (e) {\n  console.log(\"Error Parsing Outer Data:\", e);\n  return [{\n    json: {\n      chatInput: \"Failed to parse outer JSON data.\"\n    }\n  }];\n}\n\n// Step 2: Extract the actual transcript data from the 'data' field\nconst innerData = parsedData.data;\n\n// Step 3: Decode Unicode characters in the string\nconst decodedData = decodeURIComponent(innerData.replace(/\\\\u([0-9A-Fa-f]{4})/g, (match, p1) => {\n  return String.fromCharCode(parseInt(p1, 16));\n}));\n\nconsole.log(\"Decoded Data:\", decodedData); // Log the decoded data\n\n// Step 4: Check if the decoded data is a valid transcript\nif (!decodedData || decodedData.trim() === \"\") {\n  console.log(\"Invalid or empty transcript data.\");\n  return [{\n    json: {\n      chatInput: \"No valid transcript found.\"\n    }\n  }];\n}\n\n// Step 5: Return the final transcript text\nreturn [{\n  json: {\n    chatInput: decodedData\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "7cf36479-c6a8-4763-b691-72d5c03a60f8",
      "name": "优化器",
      "type": "n8n-nodes-base.code",
      "position": [
        2860,
        -80
      ],
      "parameters": {
        "jsCode": "const inputText = $input.first().json.output;\n\nfunction getFieldValue(text, field) {\n  // Updated to stop at \"---\" or end of string, instead of a non-whitespace line\n  const regex = new RegExp(`${field}:\\\\s*([\\\\s\\\\S]*?)(?=\\\\n---|$)`, 'i');\n  const match = text.match(regex);\n  return match ? match[1].trim() : '';\n}\n\nconst summary = getFieldValue(inputText, '🎬 \\\\*\\\\*Summary\\\\*\\\\*');\n\nreturn [{\n  json: {\n    summary\n  }\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "ac71fe03-898c-4cf3-9c98-f8b8f9e81346",
      "name": "AI 代理1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2300,
        -80
      ],
      "parameters": {
        "options": {
          "systemMessage": "=You are a helpful assistant that summarizes YouTube video transcripts. Given a full transcript in {{ $('Mapper').item.json.language }}, summarize the main points, topics, and tone of the video in a concise and natural manner. The summary should be provided in the same language as the transcript. Format your response like this:\n\n---\n🎬 **Summary**:  \n- [Main idea 1]  \n- [Main idea 2]  \n- [Optional tone, style, or genre]  \n---\n "
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "16681c25-5398-48f5-abf6-a02d7d4be8f2",
      "name": "YouTube 转录 AI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        40
      ],
      "parameters": {
        "url": "https://youtube-transcriptor-pro.p.rapidapi.com/yt/index.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "=videoUrl",
              "value": "={{ $json.videoUrl }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "youtube-transcriptor-pro.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3de6995f-d44e-41fe-8cee-ef38e442023f",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        -680
      ],
      "parameters": {
        "width": 700,
        "height": 1060,
        "content": "# **YouTube 转录摘要工作流程**"
      },
      "typeVersion": 1
    },
    {
      "id": "4904624a-f8b2-49d4-8a57-51b35b9e4e0c",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -180,
        -280
      ],
      "parameters": {
        "width": 380,
        "height": 440,
        "content": "#### 1. **表单提交(表单提交时)**"
      },
      "typeVersion": 1
    },
    {
      "id": "be467ebe-553d-4b95-a56b-7ccf5a717b76",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        -280
      ],
      "parameters": {
        "width": 360,
        "height": 440,
        "content": "#### 2. **映射数据(映射器)**"
      },
      "typeVersion": 1
    },
    {
      "id": "9e3ce6b1-e419-47e7-9e1b-d21789b384eb",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -280
      ],
      "parameters": {
        "width": 600,
        "height": 440,
        "content": "#### 3. **获取转录(YouTube 转录 AI)**"
      },
      "typeVersion": 1
    },
    {
      "id": "a3fb823e-9eb9-447b-b725-2f471294a64a",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1320,
        -260
      ],
      "parameters": {
        "width": 620,
        "height": 400,
        "content": "#### 4. **格式化转录(格式化器)**"
      },
      "typeVersion": 1
    },
    {
      "id": "a1f79939-cd91-4076-8bfe-7c7e40c49f3f",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2240,
        -580
      ],
      "parameters": {
        "width": 400,
        "height": 720,
        "content": "#### 5. **生成摘要(AI 代理1)**"
      },
      "typeVersion": 1
    },
    {
      "id": "ac2d887f-2371-4bf1-a054-43df1bd0c090",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2700,
        -580
      ],
      "parameters": {
        "width": 360,
        "height": 700,
        "content": "#### 6. **提取和优化(优化器)**"
      },
      "typeVersion": 1
    },
    {
      "id": "cca97d98-4d02-4298-b053-7945ee149794",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3260,
        -460
      ],
      "parameters": {
        "width": 560,
        "height": 480,
        "content": "#### 7. **更新 Google 文档(Google 文档)**"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fff226c0-4d72-46bc-93f5-4b284a89dee0",
  "connections": {
    "Mapper": {
      "main": [
        [
          {
            "node": "YouTube Transcript AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Formator": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Optimizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Optimizer": {
      "main": [
        [
          {
            "node": "Google Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Mapper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "YouTube Transcript AI": {
      "main": [
        [
          {
            "node": "Formator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, AI 摘要总结

需要付费吗?

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

工作流信息
难度等级
高级
节点数量16
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流