8
n8n 中文网amn8n.com

从转录文本中总结YouTube视频用于社交媒体

中级

这是一个AI领域的自动化工作流,包含 8 个节点。主要使用 Set, Code, GoogleDocs, FormTrigger, HttpRequest 等节点,结合人工智能技术实现智能自动化。 从转录文本中总结YouTube视频用于社交媒体

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "jCs5Yhd71bxr5Ktc",
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752",
    "templateCredsSetupCompleted": true
  },
  "name": "从转录文本中总结 YouTube 视频用于社交媒体",
  "tags": [
    {
      "id": "QXtLNWbsCSABOTNm",
      "name": "Digital Marketing",
      "createdAt": "2025-05-29T11:14:57.099Z",
      "updatedAt": "2025-05-29T11:14:57.099Z"
    }
  ],
  "nodes": [
    {
      "id": "ae2d87c7-870b-4c62-9f25-6454772cb41d",
      "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": "Yt Video Id",
              "placeholder": "abc123",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bada944a-2453-451b-ade5-1ff2ff6c6377",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        880,
        0
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are a helpful assistant that summarizes YouTube video transcripts.\n\nHere is the full transcript of a video:\nPlease provide a concise summary of the video in natural language, covering the main points, topics, and tone.\n\nFormat the output as:\n\n---\n🎬 **Summary**:\n- [Main idea 1]\n- [Main idea 2]\n- [Optional tone, style, or genre]\n---\n"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "15389a01-0f9f-43b2-821f-b0420e3095ac",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        940,
        220
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Xpxt71RcelLLFyE3",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fa5c983f-6a44-47fc-be1c-63ca9df9a94b",
      "name": "Google文档",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1500,
        0
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $json.summary }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "",
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "Rt0RWApx8PL9t0RF",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "8786afdb-097c-4b54-9055-2ad41a988ef3",
      "name": "映射器",
      "type": "n8n-nodes-base.set",
      "position": [
        220,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a2486ac7-c29c-419e-9cfc-753701723510",
              "name": "ytVideoId",
              "type": "string",
              "value": "={{ $json[\"Yt Video Id\"] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "778ade7e-951f-416c-b2d5-c91b0688ab8d",
      "name": "YouTube 转录器",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        440,
        0
      ],
      "parameters": {
        "url": "https://youtube-transcriptor-ai.p.rapidapi.com/yt/index.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "yt_video_id",
              "value": "={{ $json.ytVideoId }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host"
            },
            {
              "name": "x-rapidapi-key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "00fc4b62-b1fc-44c5-b7ce-5b2950571b9c",
      "name": "格式化器",
      "type": "n8n-nodes-base.code",
      "position": [
        660,
        0
      ],
      "parameters": {
        "jsCode": "const transcript = \n$input.first().json.tracks[0].transcript\nif (!Array.isArray(transcript) || transcript.length === 0) {\n  return [{\n    json: {\n      chatInput: \"Transcript not available or invalid video ID.\"\n    }\n  }];\n}\n\n// Join all transcript lines into a single string\nconst transcriptText = transcript.map(t => t.text).join(' ');\n\n// Return as chatInput\nreturn [{\n  json: {\n    chatInput: transcriptText\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "53c8c1d4-5250-4212-adde-bfd1a2a53b04",
      "name": "优化器",
      "type": "n8n-nodes-base.code",
      "position": [
        1240,
        0
      ],
      "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
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "cb6a2956-019a-492a-881f-b5a179ac34d3",
  "connections": {
    "Mapper": {
      "main": [
        [
          {
            "node": "Youtube Transcriptor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Optimizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Formator": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Optimizer": {
      "main": [
        [
          {
            "node": "Google Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Mapper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Youtube Transcriptor": {
      "main": [
        [
          {
            "node": "Formator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 人工智能

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流