8
n8n 中文网amn8n.com

使用RapidAPI和Google Sheets日志记录将YouTube视频转换为MP4和MP3

中级

这是一个File Management领域的自动化工作流,包含 9 个节点。主要使用 If, FormTrigger, HttpRequest, GoogleSheets 等节点。 使用RapidAPI和Google Sheets日志记录将YouTube视频转换为MP4和MP3

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "8107174c-5a28-4e08-be56-de75f9d85b01",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        300,
        0
      ],
      "parameters": {
        "url": "https://youtube-video-downloader-fast.p.rapidapi.com/download.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $json.URL }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "youtube-video-downloader-fast.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "86a2db5e-5928-4459-ad69-846994ab98d0",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "webhookId": "97a426d1-4557-4d85-8c0f-e98f6590721c",
      "parameters": {
        "options": {},
        "formTitle": "YouTube To Mp4",
        "formFields": {
          "values": [
            {
              "fieldLabel": "URL",
              "requiredField": true
            }
          ]
        },
        "formDescription": "YouTube To Mp4"
      },
      "typeVersion": 2.2
    },
    {
      "id": "a183fdce-c385-4c17-b237-a0ac731adfc0",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        560,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0380d6fd-b5ab-49ef-a5e1-5d34a138f883",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.success }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c7806bea-3eaa-464e-8939-cd707de01ba4",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        800,
        -20
      ],
      "parameters": {
        "columns": {
          "value": {
            "Mp3": "={{ $json.medias[18].url }}",
            "Url": "={{ $json.url }}",
            "Mp4 720": "={{ $json.medias[3].url }}",
            "Mp4 1080": "={{ $json.medias[1].url }}",
            "Mp4 360p": "={{ $json.medias[0].url }}"
          },
          "schema": [
            {
              "id": "Url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mp4 360p",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Mp4 360p",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mp4 720",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Mp4 720",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mp4 1080",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Mp4 1080",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Mp3",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Mp3",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1BFR7Ce8FYarGF7kvfaQf6fBsu7hLxDbzzp_RL8DDlas",
          "cachedResultUrl": "",
          "cachedResultName": "YT to Mp4"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "Rt0RWApx8PL9t0RF",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "2c42910a-7192-41e4-91b6-921a42601bb9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -900,
        -480
      ],
      "parameters": {
        "width": 740,
        "height": 740,
        "content": "# 🎥 YouTube 转 MP4 下载器"
      },
      "typeVersion": 1
    },
    {
      "id": "1fb4d9b5-c883-489b-9f05-0b851cd7b5b2",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -200
      ],
      "parameters": {
        "height": 380,
        "content": "### 1️⃣ **表单提交时**"
      },
      "typeVersion": 1
    },
    {
      "id": "a5d3d8eb-2202-4ccc-af42-aa51efd433aa",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        -200
      ],
      "parameters": {
        "height": 380,
        "content": "### 2️⃣ **HTTP 请求**"
      },
      "typeVersion": 1
    },
    {
      "id": "e572667f-8476-4aad-a72d-4ee99d191bcd",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -200
      ],
      "parameters": {
        "height": 380,
        "content": "### 3️⃣ **If 节点**"
      },
      "typeVersion": 1
    },
    {
      "id": "acc65470-0188-4d4c-a798-7862e98657cf",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -200
      ],
      "parameters": {
        "height": 380,
        "content": "### 4️⃣ **Google Sheets**"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 文件管理

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流