Visual Workflow

    JSON Code

    {
      "id": "LXU06o2fH9RTRzCC",
      "meta": {
        "instanceId": "ca3f3f1b54754cc6a8bf7018ef2c4b3d517f36ec4d32b4741e6f00bea7ac9b4a",
        "templateCredsSetupCompleted": true
      },
      "name": "Clone TikTok Videos",
      "tags": [],
      "nodes": [
        {
          "id": "ae8b8c8a-b081-41f9-a0a0-c84dc133d952",
          "name": "Get TikTok Video Page Data",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            192,
            208
          ],
          "parameters": {
            "url": "={{ $json.URL }}",
            "options": {
              "response": {
                "response": {
                  "fullResponse": true,
                  "responseFormat": "text"
                }
              }
            },
            "sendHeaders": true,
            "headerParameters": {
              "parameters": [
                {
                  "name": "User-Agent",
                  "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/91.0.4472.124"
                }
              ]
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "574a3d74-dbb6-4201-a31c-4c3d758593e5",
          "name": "Scrape raw video URL",
          "type": "n8n-nodes-base.code",
          "position": [
            624,
            208
          ],
          "parameters": {
            "jsCode": "const html = $input.first().json.data;\nconst headers = $input.first().json.headers || {};\nconst cookies = headers['set-cookie'] || [];\n\nif (!html) {\n  throw new Error(\"HTML body is undefined. Check the previous node's output.\");\n}\nconst regex = /<script id=\"__UNIVERSAL_DATA_FOR_REHYDRATION__\" type=\"application\\/json\">([\\s\\S]*?)<\\/script>/;\nconst match = html.match(regex);\n\nif (match) {\n  const jsonStr = match[1];\n  const data = JSON.parse(jsonStr);\n  const videoUrl = data?.__DEFAULT_SCOPE__?.[\"webapp.video-detail\"]?.itemInfo?.itemStruct?.video?.playAddr;\n  if (!videoUrl) {\n    throw new Error(\"Could not find video URL in the JSON data.\");\n  }\n  return [{ json: { videoUrl, cookies: cookies.join('; ') } }];\n} else {\n  throw new Error(\"Could not find __UNIVERSAL_DATA_FOR_REHYDRATION__ script in the HTML.\");\n}"
          },
          "typeVersion": 2
        },
        {
          "id": "0230165e-3d00-4d2e-891b-6cfb0add9539",
          "name": "Output video file without watermark",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            1040,
            208
          ],
          "parameters": {
            "url": "={{ $json.videoUrl }}",
            "options": {
              "response": {
                "response": {
                  "responseFormat": "file"
                }
              },
              "allowUnauthorizedCerts": true
            },
            "sendHeaders": true,
            "headerParameters": {
              "parameters": [
                {
                  "name": "User-Agent",
                  "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
                },
                {
                  "name": "Referer",
                  "value": "https://www.tiktok.com/"
                },
                {
                  "name": "Accept",
                  "value": "video/mp4,video/webm,video/*;q=0.9,application/octet-stream;q=0.8"
                },
                {
                  "name": "Accept-Language",
                  "value": "en-US,en;q=0.5"
                },
                {
                  "name": "Connection",
                  "value": "keep-alive"
                },
                {
                  "name": "Cookie",
                  "value": "={{ $json.cookies }}"
                }
              ]
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "798d3664-63ce-4d00-97aa-94c6f46a94f6",
          "name": "Sticky Note",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            0,
            0
          ],
          "parameters": {
            "color": 6,
            "width": 460,
            "height": 360,
            "content": "## 1. Load the video page\nOpen this node and replace the URL with the one of the video you want to download without a watermark.\n\nA Tiktok video URL looks like: https://www.tiktok.com/@Username_here/video/Video_ID_Here\n\nOutputs the returned page HTML along with the session cookies\n\n"
          },
          "typeVersion": 1
        },
        {
          "id": "48f33189-31d7-4518-b9f3-1191f47762a3",
          "name": "Sticky Note1",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            480,
            0
          ],
          "parameters": {
            "color": 5,
            "width": 380,
            "height": 360,
            "content": "## 2. Find the raw video URL\nParses through all of the HTML and finds the section containing the video URL before the watermark is applied"
          },
          "typeVersion": 1
        },
        {
          "id": "120131ec-551c-4010-a0a0-9854d24c027b",
          "name": "Sticky Note2",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            880,
            0
          ],
          "parameters": {
            "color": 7,
            "width": 400,
            "height": 360,
            "content": "## 3. Output video file without watermark\nUsing the cookies from step 1, a request is made to access the original video file as shown on TikTok"
          },
          "typeVersion": 1
        },
        {
          "id": "48220d2c-6c71-4045-951d-c1516f5ed423",
          "name": "Analyze video",
          "type": "@n8n/n8n-nodes-langchain.googleGemini",
          "position": [
            1344,
            208
          ],
          "parameters": {
            "text": "Analyze this video moment by moment. Describe the video to an ai video generator so I can replicate this video exactly including the audio. If there's a notable person in the video, make sure to mention who they sound like. Output ONLY a prompt for an ai video generator. Prompt can be no more than 800 characters.",
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "models/gemini-3-pro-preview",
              "cachedResultName": "models/gemini-3-pro-preview"
            },
            "options": {},
            "resource": "video",
            "inputType": "binary",
            "operation": "analyze"
          },
          "credentials": {
            "googlePalmApi": {
              "id": "rgTtCI14Pygr3UY7",
              "name": "Google Gemini - YT"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "bd30624d-4590-49fa-a5f0-36c6f9edc3af",
          "name": "On form submission",
          "type": "n8n-nodes-base.formTrigger",
          "position": [
            -144,
            208
          ],
          "webhookId": "26f1c791-5b5f-4852-8d88-63a3bda48480",
          "parameters": {
            "options": {},
            "formTitle": "video",
            "formFields": {
              "values": [
                {
                  "fieldLabel": "URL"
                },
                {
                  "fieldType": "dropdown",
                  "fieldLabel": "Video Model",
                  "fieldOptions": {
                    "values": [
                      {
                        "option": "Wan 2.5"
                      },
                      {
                        "option": "Sora 2"
                      }
                    ]
                  }
                }
              ]
            }
          },
          "typeVersion": 2.3
        },
        {
          "id": "9d2fac44-8506-4363-89a2-b14d8eafff4e",
          "name": "Upload media",
          "type": "@blotato/n8n-nodes-blotato.blotato",
          "position": [
            1040,
            512
          ],
          "parameters": {
            "mediaUrl": "={{ JSON.parse($json.data.resultJson).resultUrls[0] }}",
            "resource": "media"
          },
          "credentials": {
            "blotatoApi": {
              "id": "PLYEu7PIK1I5FU3U",
              "name": "Blotato YT"
            }
          },
          "typeVersion": 2
        },
        {
          "id": "f1b7cbc1-2289-4073-9b2c-70d63d1c6756",
          "name": "getVideo",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            512,
            528
          ],
          "parameters": {
            "url": "=https://api.kie.ai/api/v1/jobs/recordInfo?taskId={{ $json.data.taskId }}",
            "options": {},
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "K7MvLmRsdSvggmhN",
              "name": "Kie AI Oct1"
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "4f0ad0b0-337a-439f-8d21-1d9639b27fd5",
          "name": "Wait 3min",
          "type": "n8n-nodes-base.wait",
          "position": [
            272,
            528
          ],
          "webhookId": "42d8bb7d-675d-4e61-96c2-f6ecc35ef67f",
          "parameters": {
            "unit": "minutes",
            "amount": 3
          },
          "typeVersion": 1.1
        },
        {
          "id": "d6f4a2bc-75e1-4b3a-8056-0b27e23326e4",
          "name": "success?",
          "type": "n8n-nodes-base.if",
          "position": [
            704,
            528
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "a95653fe-4641-499d-b5ea-83920481c125",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $json.data.state }}",
                  "rightValue": "success"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "75503583-8b48-4874-9be4-b245970b3111",
          "name": "Sticky Note3",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            0,
            384
          ],
          "parameters": {
            "width": 464,
            "height": 336,
            "content": "## Generate with Wan 2.5\nSend the video prompt to Kie AI for video generation using Wan 2.5"
          },
          "typeVersion": 1
        },
        {
          "id": "edd1a019-d6fc-42f9-a176-2bf8c5760f0a",
          "name": "Sticky Note4",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            480,
            384
          ],
          "parameters": {
            "color": 3,
            "width": 384,
            "height": 688,
            "content": "## Wait for Video to Process"
          },
          "typeVersion": 1
        },
        {
          "id": "ae3bc7e8-fa5c-46e8-a58d-40a0e7a4263c",
          "name": "Sticky Note5",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            880,
            384
          ],
          "parameters": {
            "color": 6,
            "width": 384,
            "height": 336,
            "content": "## Upload to Blotato"
          },
          "typeVersion": 1
        },
        {
          "id": "24b99e0c-8c20-4b05-86d1-dd432b1d6553",
          "name": "Instagram",
          "type": "@blotato/n8n-nodes-blotato.blotato",
          "position": [
            1408,
            448
          ],
          "parameters": {
            "options": {},
            "accountId": {
              "__rl": true,
              "mode": "list",
              "value": "571",
              "cachedResultUrl": "https://backend.blotato.com/v2/accounts/571",
              "cachedResultName": "duncanrogoff"
            },
            "postContentText": "#sora #ai #fyp",
            "postContentMediaUrls": "={{ $json.url }}"
          },
          "credentials": {
            "blotatoApi": {
              "id": "PLYEu7PIK1I5FU3U",
              "name": "Blotato YT"
            }
          },
          "typeVersion": 2
        },
        {
          "id": "daf162cd-622e-4220-ae65-adf726140ad3",
          "name": "TikTok",
          "type": "@blotato/n8n-nodes-blotato.blotato",
          "position": [
            1408,
            592
          ],
          "parameters": {
            "options": {},
            "platform": "tiktok",
            "accountId": {
              "__rl": true,
              "mode": "list",
              "value": "560",
              "cachedResultUrl": "https://backend.blotato.com/v2/accounts/560",
              "cachedResultName": "duncanrogoff"
            },
            "postContentText": "#sora #ai #fyp",
            "postContentMediaUrls": "={{ $json.url }}",
            "postCreateTiktokOptionIsAiGenerated": true
          },
          "credentials": {
            "blotatoApi": {
              "id": "PLYEu7PIK1I5FU3U",
              "name": "Blotato YT"
            }
          },
          "typeVersion": 2
        },
        {
          "id": "5cebe697-c316-409f-a95e-8a048c3209fd",
          "name": "Twitter",
          "type": "@blotato/n8n-nodes-blotato.blotato",
          "position": [
            1632,
            432
          ],
          "parameters": {
            "options": {},
            "platform": "twitter",
            "accountId": {
              "__rl": true,
              "mode": "list",
              "value": "906",
              "cachedResultUrl": "https://backend.blotato.com/v2/accounts/906",
              "cachedResultName": "DuncanRogoff"
            },
            "postContentText": "#sora #ai #fyp",
            "postContentMediaUrls": "={{ $json.url }}"
          },
          "credentials": {
            "blotatoApi": {
              "id": "PLYEu7PIK1I5FU3U",
              "name": "Blotato YT"
            }
          },
          "typeVersion": 2
        },
        {
          "id": "08db20ab-76b6-4e41-8bd0-3b45f9b15969",
          "name": "YouTube",
          "type": "@blotato/n8n-nodes-blotato.blotato",
          "position": [
            1632,
            576
          ],
          "parameters": {
            "options": {},
            "platform": "youtube",
            "accountId": {
              "__rl": true,
              "mode": "list",
              "value": "323",
              "cachedResultUrl": "https://backend.blotato.com/v2/accounts/323",
              "cachedResultName": "Duncan Rogoff (Duncan Rogoff | AI Automation)"
            },
            "postContentText": "#sora #ai #fyp",
            "postContentMediaUrls": "={{ $json.url }}",
            "postCreateYoutubeOptionTitle": "Ok, who did this?",
            "postCreateYoutubeOptionContainsSyntheticMedia": true
          },
          "credentials": {
            "blotatoApi": {
              "id": "PLYEu7PIK1I5FU3U",
              "name": "Blotato YT"
            }
          },
          "typeVersion": 2
        },
        {
          "id": "4097d544-128b-4396-a5a9-9ba8d645e8f1",
          "name": "Sticky Note6",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            1280,
            384
          ],
          "parameters": {
            "color": 4,
            "width": 560,
            "height": 336,
            "content": "## Post to Socials"
          },
          "typeVersion": 1
        },
        {
          "id": "371d957b-1032-4847-bf2e-e1e275b5a7ee",
          "name": "Wait",
          "type": "n8n-nodes-base.wait",
          "position": [
            256,
            864
          ],
          "webhookId": "772901d1-9e0a-4dc0-96c0-7db10942340f",
          "parameters": {
            "unit": "minutes",
            "amount": 1
          },
          "typeVersion": 1.1
        },
        {
          "id": "238cd001-62bb-4c82-b799-58cbad469576",
          "name": "HTTP Request1",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            512,
            864
          ],
          "parameters": {
            "url": "https://api.kie.ai/api/v1/jobs/recordInfo",
            "options": {},
            "sendQuery": true,
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth",
            "queryParameters": {
              "parameters": [
                {
                  "name": "taskId",
                  "value": "={{ $('sora2').item.json.data.taskId }}"
                }
              ]
            }
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "K7MvLmRsdSvggmhN",
              "name": "Kie AI Oct1"
            }
          },
          "typeVersion": 4.3
        },
        {
          "id": "6f31a9d0-6b8a-4676-9f1d-258c086e735f",
          "name": "If",
          "type": "n8n-nodes-base.if",
          "position": [
            704,
            864
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "c692062a-1e29-4c33-aab2-d96b96c82e00",
                  "operator": {
                    "name": "filter.operator.equals",
                    "type": "string",
                    "operation": "equals"
                  },
                  "leftValue": "={{ $json.data.state }}",
                  "rightValue": "success"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "291eb92d-c708-41f7-9bbd-d40ab88ba24f",
          "name": "Sticky Note7",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            0,
            736
          ],
          "parameters": {
            "width": 464,
            "height": 336,
            "content": "## Generate with Sora 2\nSend the video prompt to Kie AI for video generation using Wan 2.5"
          },
          "typeVersion": 1
        },
        {
          "id": "0f58acfc-d10a-47c7-8944-f4fbfec4aa03",
          "name": "Switch",
          "type": "n8n-nodes-base.switch",
          "position": [
            -144,
            656
          ],
          "parameters": {
            "rules": {
              "values": [
                {
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "1bf5f09a-ab8c-4f44-b7d7-7c61a93aba19",
                        "operator": {
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('On form submission').item.json['Video Model'] }}",
                        "rightValue": "Wan 2.5"
                      }
                    ]
                  }
                },
                {
                  "outputKey": "Sora 2",
                  "conditions": {
                    "options": {
                      "version": 2,
                      "leftValue": "",
                      "caseSensitive": true,
                      "typeValidation": "strict"
                    },
                    "combinator": "and",
                    "conditions": [
                      {
                        "id": "caba5296-b8b4-4f85-b615-25f7859a6910",
                        "operator": {
                          "type": "string",
                          "operation": "equals"
                        },
                        "leftValue": "={{ $('On form submission').item.json['Video Model'] }}",
                        "rightValue": "Sora 2"
                      }
                    ]
                  },
                  "renameOutput": true
                }
              ]
            },
            "options": {}
          },
          "typeVersion": 3.3
        },
        {
          "id": "4e774720-6df9-4bb6-bc2b-31eae0b22b77",
          "name": "sora2",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            64,
            864
          ],
          "parameters": {
            "url": "https://api.kie.ai/api/v1/jobs/createTask",
            "method": "POST",
            "options": {},
            "jsonBody": "={\n  \"model\": \"sora-2-text-to-video\",\n  \"input\": {\n    \"prompt\": \"{{ $json.content.parts[0].text.replace(/[\"\\n\\r]/g, '') }}\",\n    \"aspect_ratio\": \"portrait\",\n    \"n_frames\": \"10\",\n    \"remove_watermark\": true\n  }\n}",
            "sendBody": true,
            "specifyBody": "json",
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "K7MvLmRsdSvggmhN",
              "name": "Kie AI Oct1"
            }
          },
          "typeVersion": 4.3
        },
        {
          "id": "cff03810-5d44-4d78-b0a7-b979064088b0",
          "name": "wan2.5",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            64,
            528
          ],
          "parameters": {
            "url": "https://api.kie.ai/api/v1/jobs/createTask",
            "method": "POST",
            "options": {},
            "jsonBody": "={\n  \"model\": \"wan/2-5-text-to-video\",\n  \"input\": {\n    \"prompt\": \"{{ $json.content.parts[0].text.replace(/[\"\\n\\r]/g, '') }}\",\n    \"aspect_ratio\": \"9:16\",\n    \"duration\": \"10\",\n    \"resolution\": \"720p\",\n    \"enable_prompt_expansion\": false\n  }\n}\n\n\n",
            "sendBody": true,
            "specifyBody": "json",
            "authentication": "genericCredentialType",
            "genericAuthType": "httpHeaderAuth"
          },
          "credentials": {
            "httpHeaderAuth": {
              "id": "K7MvLmRsdSvggmhN",
              "name": "Kie AI Oct1"
            }
          },
          "typeVersion": 4.2
        }
      ],
      "active": false,
      "pinData": {},
      "settings": {
        "executionOrder": "v1"
      },
      "versionId": "005c42d3-1c21-4635-b9ab-87ce753ecb9b",
      "connections": {
        "If": {
          "main": [
            [
              {
                "node": "Upload media",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Wait",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Wait": {
          "main": [
            [
              {
                "node": "HTTP Request1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "sora2": {
          "main": [
            [
              {
                "node": "Wait",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Switch": {
          "main": [
            [
              {
                "node": "wan2.5",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "sora2",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "wan2.5": {
          "main": [
            [
              {
                "node": "getVideo",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "getVideo": {
          "main": [
            [
              {
                "node": "success?",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "success?": {
          "main": [
            [
              {
                "node": "Upload media",
                "type": "main",
                "index": 0
              }
            ],
            [
              {
                "node": "Wait 3min",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Wait 3min": {
          "main": [
            [
              {
                "node": "getVideo",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Upload media": {
          "main": [
            [
              {
                "node": "Instagram",
                "type": "main",
                "index": 0
              },
              {
                "node": "TikTok",
                "type": "main",
                "index": 0
              },
              {
                "node": "Twitter",
                "type": "main",
                "index": 0
              },
              {
                "node": "YouTube",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Analyze video": {
          "main": [
            [
              {
                "node": "Switch",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "HTTP Request1": {
          "main": [
            [
              {
                "node": "If",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "On form submission": {
          "main": [
            [
              {
                "node": "Get TikTok Video Page Data",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Scrape raw video URL": {
          "main": [
            [
              {
                "node": "Output video file without watermark",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Get TikTok Video Page Data": {
          "main": [
            [
              {
                "node": "Scrape raw video URL",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Output video file without watermark": {
          "main": [
            [
              {
                "node": "Analyze video",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }