8
n8n 中文网amn8n.com

Spotify音乐下载至Google云端硬盘并自动记录到表格

高级

这是一个File Management领域的自动化工作流,包含 25 个节点。主要使用 If, Code, Wait, FormTrigger, GoogleDrive 等节点。 将Spotify音乐下载到Google云端硬盘,并在表格中自动记录下载日志

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752"
  },
  "nodes": [
    {
      "id": "8b589726-cc0e-47e1-8ada-b098d551787c",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -200,
        0
      ],
      "webhookId": "00b30d60-ba60-4b3c-a08b-b9f8f7c0dc75",
      "parameters": {
        "options": {},
        "formTitle": "Spotify Music Downloader",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Link",
              "placeholder": "https://open.spotify.com/track/abcd44?si=ZXw&nd=1&dlsi=b3a",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Paster link of spotify music"
      },
      "typeVersion": 2.2
    },
    {
      "id": "fe66d327-610b-4c07-955b-4f6a922f14a0",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        240,
        -20
      ],
      "parameters": {
        "url": "https://spotify-downloader11.p.rapidapi.com/spotify-downloader.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $json.Link }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "spotify-downloader11.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a519e85f-dfa5-436d-833e-31d5ed3cb6f1",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        -20,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d5b4a26a-13eb-487a-9edd-ac831ce8ca1f",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Link }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f24f1513-b5ab-4c6a-8f57-2d2a1bb03954",
      "name": "条件判断1",
      "type": "n8n-nodes-base.if",
      "position": [
        500,
        20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d5b4a26a-13eb-487a-9edd-ac831ce8ca1f",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "success"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "429a1eb2-ddee-4d3d-85c4-b755c999febe",
      "name": "下载音乐",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        840,
        -400
      ],
      "parameters": {
        "url": "={{ $json.download_url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "062222fa-77d3-493b-8f4b-de96590c3c95",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1120,
        -420
      ],
      "parameters": {
        "name": "data",
        "driveId": {
          "__rl": true,
          "mode": "id",
          "value": "1MH4rVD9lziY-acugKQFoitbE6Gv5vdLl"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1MH4rVD9lziY-acugKQFoitbE6Gv5vdLl",
          "cachedResultUrl": "l",
          "cachedResultName": "spotify to mp3"
        },
        "inputDataFieldName": "=data"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "qEkQ8MFn0uSHgAqY",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "1d754442-11ec-4e30-95ff-01b53491f877",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2500,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "URL": "={{ $('On form submission').item.json.Link }}",
            "Size": "={{ $('Code').item.json.fileSizeInMb }} MB",
            "Status": "Success",
            "Created at": "={{ $now.format('dd-MM-yyyy') }}",
            "Download Link": "={{ $('Google Drive').item.json.webContentLink }}",
            "Web View Link": "={{ $('Google Drive').item.json.webViewLink }}"
          },
          "schema": [
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Download Link",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Download Link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Web View Link",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Web View Link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Size",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Size",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Created at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "URL"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "15jM_yCs_m72wcoDDYr6wsiXzADgj1efLZDgE3nXbmOg"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "3b745c8b-bbfa-4302-a93f-6ea24d7915da",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        1800,
        -320
      ],
      "parameters": {
        "jsCode": "function kbToMb(kb) {\n    return (kb / 1024).toFixed(2); // Convert KB to MB\n}\n\nfunction bytesToKb(bytes) {\n    return bytes / 1024;  // Convert Bytes to KB\n}\n\n// Get the file size in bytes from the input (from the Google Drive node)\nlet fileSizeInBytes = $('Google Drive').first().json.size;\n\n// Convert bytes to KB first\nlet fileSizeInKb = bytesToKb(fileSizeInBytes);\n\n// Then convert KB to MB\nlet fileSizeInMb = kbToMb(fileSizeInKb);\n\nlet outputData = {\n    fileName: $input.first().json.name,\n    fileSizeInMb: fileSizeInMb\n};\n\n// Return an array containing the output data\nreturn [{ json: outputData }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "e148bc42-ecb2-44af-b8f4-4b713f4b427c",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1440,
        200
      ],
      "parameters": {
        "columns": {
          "value": {
            "URL": "={{ $('On form submission').item.json.Link }}",
            "Size": "=N/A",
            "Status": "=failed",
            "Created at": "={{ $now.format('dd-MM-yyyy') }}",
            "Download Link": "N/A",
            "Web View Link": "=N/A"
          },
          "schema": [
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Download Link",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Download Link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Web View Link",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Web View Link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Size",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Size",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Created at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "URL"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "15jM_yCs_m72wcoDDYr6wsiXzADgj1efLZDgE3nXbmOg"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "6885550a-a1e5-46cf-835e-aad57c3a051a",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        1000,
        240
      ],
      "webhookId": "70524744-1b73-4068-941a-f55c8c8feb9c",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "910f0b8d-7e3a-4dd3-932e-453ba5d487d7",
      "name": "等待1",
      "type": "n8n-nodes-base.wait",
      "position": [
        2240,
        -320
      ],
      "webhookId": "ac0265ba-f888-4d4b-a88f-a5a94f538b79",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "c4302364-9c96-4f6c-b4ca-85083012a0e8",
      "name": "Google Sheets2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1460,
        -500
      ],
      "parameters": {
        "columns": {
          "value": {
            "URL": "={{ $('On form submission').item.json.Link }}"
          },
          "schema": [
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Download Link",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Download Link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Web View Link",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Web View Link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Size",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Size",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created at",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Created at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "URL"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "15jM_yCs_m72wcoDDYr6wsiXzADgj1efLZDgE3nXbmOg"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "qUtlCnYpk7bXXaYp",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a622eaef-5494-4294-8a2d-90f6ace4673d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        -300
      ],
      "parameters": {
        "width": 560,
        "height": 1020,
        "content": "# Spotify 音乐下载器流程"
      },
      "typeVersion": 1
    },
    {
      "id": "a6c8f56d-3cd2-4b8e-85d7-98f6d02275ce",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -200
      ],
      "parameters": {
        "height": 340,
        "content": "**表单提交时:**"
      },
      "typeVersion": 1
    },
    {
      "id": "708465a5-c968-459d-844b-27b1c05f39dd",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -200
      ],
      "parameters": {
        "height": 340,
        "content": "**如果(链接检查):**"
      },
      "typeVersion": 1
    },
    {
      "id": "43722f14-157e-4ba4-8d18-26681a8eaa6f",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -200
      ],
      "parameters": {
        "height": 340,
        "content": "**HTTP 请求:**"
      },
      "typeVersion": 1
    },
    {
      "id": "a2344ebe-f7bf-4a88-8295-1ff777c25d09",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -200
      ],
      "parameters": {
        "height": 340,
        "content": "**如果1(成功检查):**"
      },
      "typeVersion": 1
    },
    {
      "id": "f2ab9746-ce9c-416b-a0c8-9be6378ce288",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        -560
      ],
      "parameters": {
        "height": 320,
        "content": "**下载音乐:**"
      },
      "typeVersion": 1
    },
    {
      "id": "697e5b8c-887b-4c6d-9c25-4a59f56a663a",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        -600
      ],
      "parameters": {
        "height": 360,
        "content": "**Google Drive:**"
      },
      "typeVersion": 1
    },
    {
      "id": "2a4e9899-d4f4-475a-a36b-9bc45f2ee5ff",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        20
      ],
      "parameters": {
        "height": 400,
        "content": "**等待:**"
      },
      "typeVersion": 1
    },
    {
      "id": "56642ab2-bdbb-457c-beaf-115677a39e2a",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        -720
      ],
      "parameters": {
        "width": 280,
        "height": 380,
        "content": "7. **Google Sheets:**"
      },
      "typeVersion": 1
    },
    {
      "id": "3a0fa583-5bc3-4e7e-8cdd-8735cced94ab",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1740,
        -600
      ],
      "parameters": {
        "height": 420,
        "content": "**代码:**"
      },
      "typeVersion": 1
    },
    {
      "id": "d2b90077-85eb-4989-866a-035c96794925",
      "name": "便签 10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2440,
        -260
      ],
      "parameters": {
        "height": 380,
        "content": "**Google Sheets1:**"
      },
      "typeVersion": 1
    },
    {
      "id": "9f3a15c7-1577-4a55-959c-52a00e6640e6",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2160,
        -560
      ],
      "parameters": {
        "height": 380,
        "content": "**等待1:**"
      },
      "typeVersion": 1
    },
    {
      "id": "859207a9-1ae6-442b-86a2-c0e931d00482",
      "name": "便签 12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1380,
        -20
      ],
      "parameters": {
        "width": 260,
        "height": 380,
        "content": "**Google Sheets2:**"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Download music",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Google Sheets2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download music": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets2": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 文件管理

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流