{
  "nodes": [
    {
      "id": "1f1e7b14-6814-4c30-9dce-211caa08e082",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -720,
        520
      ],
      "parameters": {
        "options": {},
        "formTitle": "All In one video downloader ",
        "formFields": {
          "values": [
            {
              "fieldLabel": "URL",
              "requiredField": true
            }
          ]
        },
        "formDescription": "All In one video downloader "
      },
      "typeVersion": 2.2
    },
    {
      "id": "de0f708b-2c26-41c9-b516-1ea8d9bcfb8d",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -200,
        540
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bcc58e3d-9609-4ec3-adb9-bc6098205818",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "2d7b25c6-4a8f-46ec-bde9-f8c622890738",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        140,
        780
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "b18fefc0-9200-4036-8b00-6f283dc157c5",
      "name": "Download mp4",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        60,
        260
      ],
      "parameters": {
        "url": "={{ $json.medias[0].url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "6a9e7805-28b3-4b6e-b6dd-6c462f60eb03",
      "name": "Google Drive Set Permission",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        620,
        240
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "resource": "file",
        "operation": "share",
        "permissionsUi": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "8762a204-a9e8-4422-b50b-c0ca2aa2d2be",
      "name": "Upload To Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        320,
        240
      ],
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "a6d7d6e3-bf55-4c0f-98f3-a4a1510073ca",
      "name": "Google Sheets Append Row",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        620,
        780
      ],
      "parameters": {
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "2b2437f7-545c-4326-a43c-89288e8e82b4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        240
      ],
      "parameters": {
        "height": 500,
        "content": "## \ud83d\udfe2 **1. On form submission**\n- **Purpose:** Acts as the trigger for the workflow.  \n- **Functionality:** Displays a form with a single field (`URL`) where users can enter the  video link.  \n- **Output:** Passes the entered URL to the next node for processing."
      },
      "typeVersion": 1
    },
    {
      "id": "f12c6be6-fc8f-4f99-9d65-b627646cb980",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        240
      ],
      "parameters": {
        "height": 500,
        "content": "## \ud83c\udf10 **2. All In One Downloader**\n- **Purpose:** Fetch downloadable MP4 link.  \n- **Functionality:** Sends a `POST` request to **RapidAPI ALl in one Video Downloader API**, passing the URL from the form.  \n- **Output:** Receives a JSON response containing downloadable media links.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bf05529a-b500-4a38-bd51-9b6f147291d8",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -260,
        240
      ],
      "parameters": {
        "height": 500,
        "content": "## \ud83d\udd0d **3. If**\n- **Purpose:** Check for API errors.  \n- **Functionality:** Evaluates if the response contains an `error` field.  \n- **Output:** \n  - \u2705 **True Path:** Proceeds to download the MP4.  \n  - \u274c **False Path:** Goes to error handling (Wait + Sheets logging).\n"
      },
      "typeVersion": 1
    },
    {
      "id": "45c1849f-3b6b-4630-bc06-5089ca16781e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "height": 440,
        "content": "## \u2b07\ufe0f **4. Download mp4**\n- **Purpose:** Download the video file.  \n- **Functionality:** Uses the media URL from the previous API response to download the MP4 video.  \n- **Output:** Stores the raw MP4 binary for upload.\n\n-"
      },
      "typeVersion": 1
    },
    {
      "id": "2949b3d7-288a-47d7-8bda-2d6b0bc10021",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        260,
        0
      ],
      "parameters": {
        "height": 400,
        "content": "## \u2601\ufe0f **5. Upload To Google Drive**\n- **Purpose:** Store video in Google Drive.  \n- **Functionality:** Uploads the downloaded MP4 into the specified Drive folder.  \n- **Output:** Returns a file ID for the uploaded file.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "03e1b932-59bd-473a-9a43-5125358b2b35",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        540,
        0
      ],
      "parameters": {
        "height": 380,
        "content": "## \ud83d\udd11 **6. Google Drive Set Permission**\n- **Purpose:** Make the file publicly accessible.  \n- **Functionality:** Sets file permissions to `Anyone with the link can view`.  \n- **Output:** Provides a sharable `webViewLink`.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "86d90bf2-8972-4d53-b4d1-a6fc9898f569",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        540
      ],
      "parameters": {
        "height": 360,
        "content": "## \u23f1\ufe0f **8. Wait**\n- **Purpose:** Delay before logging failures.  \n- **Functionality:** Pauses workflow execution to avoid instant sheet logging when API errors occur.  \n- **Output:** Prevents rapid consecutive writes to Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "80aaf060-37a1-40cc-a6ff-abf45b99851a",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        540,
        420
      ],
      "parameters": {
        "height": 480,
        "content": "## \ud83d\udcd1 **9. Google Sheets Append Row**\n- **Purpose:** Log failed conversions.  \n- **Functionality:** Appends a row with:\n  - `URL` \u2192 Original LinkedIn link  \n  - `Drive_URL` \u2192 `N/A` (indicating download failure)  \n- **Output:** Tracks failed attempts separately.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7b986eec-89fb-4ae6-91d2-e180921d78d3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        60
      ],
      "parameters": {
        "width": 420,
        "height": 1140,
        "content": "## \ud83e\udde9 All-In-One Video Downloader and Google Drive Uploader\n\n### \ud83d\udcc4 Workflow Description\n\nThis workflow allows users to submit any video URL through a form and automates the process of:\n\n1. Extracting a downloadable video link using the **RapidAPI All-In-One Video Downloader**.\n2. Downloading the video (MP4 format).\n3. Uploading the video to a connected **Google Drive** account.\n4. Making the uploaded file **publicly shareable**.\n5. Logging any failed download attempts to a **Google Sheet**.\n\n---\n\n### \u2705 Features\n\n- \ud83d\udd17 **Form Trigger:** Accepts video URLs from users via a simple form.\n- \ud83c\udf10 **Universal Video Support:** Uses an API that supports platforms like LinkedIn, Facebook, Instagram, and more.\n- \ud83d\udce5 **Video Downloading:** Automatically fetches the MP4 from the response.\n- \u2601\ufe0f **Drive Upload:** Stores the downloaded video in Google Drive.\n- \ud83d\udd13 **Permission Setup:** Shares the uploaded video with \u201cAnyone with the link\u201d access.\n- \ud83e\uddfe **Error Logging:** Records failed attempts (URL + failure info) in a Google Sheet for future analysis.\n\n---\n\n### \ud83d\udd01 Example Use Cases\n\n- Save personal social media videos directly to cloud storage.\n- Build a central media archive from various platforms.\n- Track failed downloads for debugging or retry purposes.\n\n---\n\n### \ud83d\udea7 Dependencies\n\n- \u2705 RapidAPI Key for the video downloader API.\n- \u2705 Google Drive OAuth credentials.\n- \u2705 Google Sheets access (Service Account or OAuth).\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "69db5bcb-f21d-4cf3-bc61-eb1b6e3feb2e",
      "name": "All in one video downloader",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -500,
        520
      ],
      "parameters": {
        "url": "https://best-all-in-one-video-downloader.p.rapidapi.com/index.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": "linkedin-video-downloader3.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Download mp4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Google Sheets Append Row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download mp4": {
      "main": [
        [
          {
            "node": "Upload To Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "All in one video downloader",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload To Google Drive": {
      "main": [
        [
          {
            "node": "Google Drive Set Permission",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "All in one video downloader": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}