AI NÊN SỬ DỤNG WORKFLOW NÀY?

  • CONTENT CREATORS, SOCIAL MEDIA MANAGERS & MARKETERS
    • Tải video gốc để phân tích nội dung, chỉnh sửa và đăng lại trên các nền tảng khác
  • NHÀ NGHIÊN CỨU & PHÂN TÍCH XU HƯỚNG
    • Thu thập video phục vụ nghiên cứu thị trường, đối thủ và xu hướng viral

VẤN ĐỀ WORKFLOW NÀY GIẢI QUYẾT

  • Các website tải video TikTok thường có quảng cáo, giới hạn tải xuống hoặc rủi ro về quyền riêng tư
  • Workflow này cung cấp giải pháp tự động, an toàn và có thể tích hợp trực tiếp vào hệ thống của bạn

CÁCH HOẠT ĐỘNG CỦA WORKFLOW

  • TRÍCH XUẤT VIDEO GỐC TỪ TIKTOK
    • Nhận URL video TikTok do người dùng cung cấp
    • Phân tích dữ liệu HTML để tìm link video gốc không watermark
    • Tải xuống video với chất lượng cao nhất
  • TÍCH HỢP LƯU TRỮ (TÙY CHỌN)
    • Tải lên Google Drive và tạo link chia sẻ công khai

CÀI ĐẶT (THỜI GIAN ƯỚC TÍNH: 5-10 PHÚT)

  • Cài đặt n8n
  • Chuẩn bị URL video TikTok cần tải
  • (Tùy chọn) Kích hoạt Google Drive API trong Google Cloud Console nếu muốn tự động lưu video lên Google Drive

TÙY CHỈNH WORKFLOW THEO NHU CẦU

  • Tải video từ nhiều nguồn TikTok khác nhau
  • Tùy chỉnh cách đặt tên file khi tải về
  • Tích hợp với công cụ chỉnh sửa video tự động
  • Kết nối với webhook để kích hoạt từ ứng dụng bên ngoài
  • Lập lịch tải video theo tài khoản cụ thể để theo dõi nội dung trending

ỨNG DỤNG MỞ RỘNG

Workflow này có thể được sử dụng để:

  • Phân tích nội dung viral trên TikTok
  • Nghiên cứu đối thủ và xu hướng ngành
  • Tạo video tổng hợp, biên tập nội dung
  • Xây dựng thư viện video để tham khảo và sáng tạo nội dung

Tự động hóa quá trình tải video TikTok giúp bạn tiết kiệm thời gian và tối ưu quy trình làm việc trong lĩnh vực sáng tạo nội dung và tiếp thị số!

Code Json:

{
  "nodes": [
    {
      "parameters": {},
      "id": "4dc30078-c7df-4bcb-91ed-953cd6da4a13",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        380,
        240
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "url": "https://www.tiktok.com/@quizzystudytime/video/7372914519867264272?q=marketing&t=1741964351792",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/91.0.4472.124"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "text"
            }
          }
        }
      },
      "id": "5598aa10-f667-4023-b9de-fe07e86badec",
      "name": "Get TikTok Video Page Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        240
      ],
      "typeVersion": 4.2
    },
    {
      "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}"
      },
      "id": "734a5304-f67f-4ace-a1da-0d268664452c",
      "name": "Scrape raw video URL",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        240
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "url": "={{ $json.videoUrl }}",
        "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 }}"
            }
          ]
        },
        "options": {
          "allowUnauthorizedCerts": true,
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "id": "f574ccb8-6f5f-4e55-a2d5-7ad775d3c4e5",
      "name": "Output video file without watermark",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1020,
        240
      ],
      "typeVersion": 4.2
    },
    {
      "parameters": {
        "name": "={{ $node[\"Get TikTok Video Page Data\"].parameter[\"url\"].match(/\\/video\\/(\\d+)/)[1] + \".mp4\" }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultUrl": "https://drive.google.com/drive",
          "cachedResultName": "/ (Root folder)"
        },
        "options": {}
      },
      "id": "36629265-f139-433f-9603-0670a08be1ed",
      "name": "Upload to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1240,
        240
      ],
      "typeVersion": 3,
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "bcOOmn1HApa4ltSq",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "operation": "share",
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "permissionsUi": {
          "permissionsValues": {
            "role": "writer",
            "type": "anyone",
            "allowFileDiscovery": true
          }
        },
        "options": {}
      },
      "id": "94364c83-14ce-48c3-afe5-b7cd8addd2a0",
      "name": "Set file permissions to public with link",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1460,
        240
      ],
      "typeVersion": 3,
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "bcOOmn1HApa4ltSq",
          "name": "Google Drive account"
        }
      }
    }
  ],
  "connections": {
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Get TikTok Video Page Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get TikTok Video Page Data": {
      "main": [
        [
          {
            "node": "Scrape raw video URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape raw video URL": {
      "main": [
        [
          {
            "node": "Output video file without watermark",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output video file without watermark": {
      "main": [
        [
          {
            "node": "Upload to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Google Drive": {
      "main": [
        [
          {
            "node": "Set file permissions to public with link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateId": "3146",
    "instanceId": "3a518cf9c1233b7b7bac22dfea1751b4d34a0a3fbe239239f0d74077e5203687"
  }
}
JSON

💬 Nếu có bất kỳ thắc mắc nào, hãy để lại comment bên dưới để được giải đáp nhanh nhất!

Categorized in:

Templates N8N,