8
n8n 中文网amn8n.com

使用Sora2 Pro创建视频并上传到YouTube

高级

这是一个自动化工作流,包含 22 个节点。主要使用 If, Set, Wait, GoogleDrive, HttpRequest 等节点。 使用Sora2 Pro生成AI视频,保存到Google云端硬盘并上传到YouTube

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "IIQhSqMWv4u6e0Jh",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462"
  },
  "name": "使用 Sora2 Pro 创建视频并上传到 YouTube",
  "tags": [],
  "nodes": [
    {
      "id": "937d8d50-60e9-4ebe-a1b2-83e4e7179318",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -528,
        976
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ef6db75d-f9d9-459d-9d3f-5d77547efa36",
      "name": "获取状态",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        544,
        976
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/sora-2/requests/{{ $('Create Video').item.json.request_id }}/status ",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "63bd7d00-8a53-4bc3-bc8d-c09b6ecc335e",
      "name": "等待 60 秒",
      "type": "n8n-nodes-base.wait",
      "position": [
        352,
        976
      ],
      "webhookId": "490facb8-d0ae-402e-ab59-a87720cf0bdd",
      "parameters": {
        "amount": 60
      },
      "typeVersion": 1.1
    },
    {
      "id": "13a8b42c-5951-441d-9258-be1e66ca4aff",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -528,
        832
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "230cc85e-f0cb-4bc6-8d93-df015c86a4d5",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -336
      ],
      "parameters": {
        "color": 3,
        "width": 740,
        "height": 280,
        "content": "# 使用 Sora2 Pro 生成 AI 视频,保存到 Google Drive 并上传到 YouTube"
      },
      "typeVersion": 1
    },
    {
      "id": "3748afbd-d6a6-4e6a-a8b3-c9c84d8997f1",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -16
      ],
      "parameters": {
        "width": 740,
        "height": 200,
        "content": "## 步骤 1 - GOOGLE SHEET"
      },
      "typeVersion": 1
    },
    {
      "id": "73a642fc-5ce1-4ae6-8f1b-c1b419495041",
      "name": "已完成?",
      "type": "n8n-nodes-base.if",
      "position": [
        720,
        976
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "383d112e-2cc6-4dd4-8985-f09ce0bd1781",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "45fc0b4c-7035-4063-b9ab-c4fc5815d225",
      "name": "更新结果",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        560,
        1232
      ],
      "parameters": {
        "columns": {
          "value": {
            "VIDEO": "={{ $('Get Url Video').item.json.video.url }}",
            "row_number": "={{ $('Get new video').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "PROMPT",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "PROMPT",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "DURATION",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "DURATION",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "VIDEO",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "VIDEO",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "YOUTUBE_URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "YOUTUBE_URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/11ebWJvwwXHgvQld9kxywKQUvIoBw6xMa0g0BuIqHDxE/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ/edit?usp=drivesdk",
          "cachedResultName": "Video Google Veo3"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "1a1b25e9-c29f-4b43-9f31-17c2e48910f9",
      "name": "设置数据",
      "type": "n8n-nodes-base.set",
      "position": [
        -80,
        976
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c713d31f-9abd-496a-ac79-e8e2efe60aa0",
              "name": "prompt",
              "type": "string",
              "value": "={{ $json.PROMPT }}\n\nDuration of the video: {{ $json.DURATION }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0930ee9f-15a5-43f6-88e8-cad19ec71996",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        656
      ],
      "parameters": {
        "width": 740,
        "height": 100,
        "content": "## 步骤 4 - 主流程"
      },
      "typeVersion": 1
    },
    {
      "id": "446098fa-aed9-4dfc-8c28-11f81d030d6a",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        224
      ],
      "parameters": {
        "width": 740,
        "height": 140,
        "content": "## 步骤 2 - 获取 API 密钥 (YOURAPIKEY)"
      },
      "typeVersion": 1
    },
    {
      "id": "4d02e746-f9f1-43c2-b465-51c3b63b508a",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        912
      ],
      "parameters": {
        "width": 180,
        "height": 200,
        "content": "设置在步骤 2 中创建的 API 密钥"
      },
      "typeVersion": 1
    },
    {
      "id": "3dfe7501-4d15-463e-9051-24daefd8fa42",
      "name": "获取新视频",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -304,
        976
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "VIDEO"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ/edit?usp=drivesdk",
          "cachedResultName": "Video Google Veo3"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "291e884f-4eb0-4662-9b94-eedbdb8e0154",
      "name": "创建视频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        144,
        976
      ],
      "parameters": {
        "url": "https://queue.fal.run/fal-ai/sora-2/text-to-video/pro",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n     \"prompt\": \"{{$json.prompt}}\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4e1d95dd-ccf8-4054-ace5-ff04b0a0dc52",
      "name": "获取视频 URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -528,
        1344
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/sora-2/requests/{{ $json.request_id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e1a51a77-076d-4e7e-9b6b-b42ce79f3f3b",
      "name": "获取视频文件",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        96,
        1344
      ],
      "parameters": {
        "url": "={{ $('Get Url Video').item.json.video.url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "0d378e85-76c1-497b-9af5-b079c42f38a0",
      "name": "上传视频",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        384,
        1232
      ],
      "parameters": {
        "name": "={{ $now.format('yyyyLLddHHmmss') }}-{{ $('Get Url Video').item.json.video.file_name }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1aHRwLWyrqfzoVC8HoB-YMrBvQ4tLC-NZ",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1aHRwLWyrqfzoVC8HoB-YMrBvQ4tLC-NZ",
          "cachedResultName": "Fal.run"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "HEy5EuZkgPZVEa9w",
          "name": "Google Drive account (n3w.it)"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "96457a30-4992-482d-8433-f06bc0421515",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        384,
        1456
      ],
      "parameters": {
        "url": "https://api.upload-post.com/api/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "title",
              "value": "={{ $('Generate title').item.json.message.content }}"
            },
            {
              "name": "user",
              "value": "YOUR_USERNAME"
            },
            {
              "name": "platform[]",
              "value": "youtube"
            },
            {
              "name": "video",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "DEE2XGvhGodgbAJh",
          "name": "Upload-post.com API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "101a6beb-aafd-4c29-9859-c68311b99852",
      "name": "生成标题",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -288,
        1344
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5",
          "cachedResultName": "GPT-5"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Input: {{ $('Get new video').item.json.PROMPT }}"
            },
            {
              "role": "system",
              "content": "You are a YouTube SEO expert specialized in creating engaging and optimized titles.\n\nYour task is to generate an effective title for a YouTube video based on the user's video description.\n\nGUIDELINES:\n- Maximum 60 characters to avoid truncation\n- Use relevant keywords for SEO\n- Make the title catchy and clickable\n- Avoid excessive or misleading clickbait\n- Consider the target audience of the content\n- Use numbers, questions, or power words when appropriate\n- IMPORTANT: Generate the title in the same language as the input description\n\nOUTPUT FORMAT:\nProvide only the title, without additional explanations.\n\nEXAMPLE:\nInput: \"Tutorial video on how to cook perfect pasta carbonara\"\nOutput: \"PERFECT Carbonara in 10 Minutes - Chef's Secrets\""
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "TefveNaDaMERl1hY",
          "name": "OpenAi account (Eure)"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "dfcfcd40-3271-40e0-b729-59e771b3407f",
      "name": "更新 YouTube URL",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        560,
        1456
      ],
      "parameters": {
        "columns": {
          "value": {
            "VIDEO": "=",
            "row_number": "={{ $('Get new video').item.json.row_number }}",
            "YOUTUBE_URL": "https://youtu.be/{{ $json.results.youtube.video_id }}"
          },
          "schema": [
            {
              "id": "PROMPT",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "PROMPT",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "DURATION",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "DURATION",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "VIDEO",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "VIDEO",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "YOUTUBE_URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "YOUTUBE_URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/11ebWJvwwXHgvQld9kxywKQUvIoBw6xMa0g0BuIqHDxE/edit#gid=0",
          "cachedResultName": "Foglio1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pcoY9N_vQp44NtSRR5eskkL5Qd0N0BGq7Jh_4m-7VEQ/edit?usp=drivesdk",
          "cachedResultName": "Video Google Veo3"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "JYR6a64Qecd6t8Hb",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "7aa5806b-77da-4b64-ae4a-34f2f5d1113c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        1392
      ],
      "parameters": {
        "width": 180,
        "height": 200,
        "content": "在步骤 3 中设置 YOUR_USERNAME"
      },
      "typeVersion": 1
    },
    {
      "id": "da27fe7b-4a1d-4097-aa3e-1b81da1f6b2a",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        416
      ],
      "parameters": {
        "width": 740,
        "height": 200,
        "content": "## 步骤 3 - 在 Youtube 上上传视频"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e2a0cd06-f0f4-425f-95cc-531bb2df468c",
  "connections": {
    "Set data": {
      "main": [
        [
          {
            "node": "Create Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Completed?": {
      "main": [
        [
          {
            "node": "Get Url Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 60 sec.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get status": {
      "main": [
        [
          {
            "node": "Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Video": {
      "main": [
        [
          {
            "node": "Wait 60 sec.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Update Youtube URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video": {
      "main": [
        [
          {
            "node": "Update result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 60 sec.": {
      "main": [
        [
          {
            "node": "Get status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Url Video": {
      "main": [
        [
          {
            "node": "Generate title",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get new video": {
      "main": [
        [
          {
            "node": "Set data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate title": {
      "main": [
        [
          {
            "node": "Get File Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File Video": {
      "main": [
        [
          {
            "node": "Upload Video",
            "type": "main",
            "index": 0
          },
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Get new video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级

需要付费吗?

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

工作流信息
难度等级
高级
节点数量22
分类-
节点类型10
难度说明

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

作者

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza

外部链接
在 n8n.io 查看

分享此工作流