8
n8n 中文网amn8n.com

TikTok、RapidAPI和Google Sheets服务模板

中级

这是一个Market Research领域的自动化工作流,包含 15 个节点。主要使用 HttpRequest, GoogleSheets, SplitInBatches, ScheduleTrigger 等节点。 TikTok、RapidAPI和Google Sheets服务模板

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "60c025075753afcab9f803964b4caaca9402f435deb4efafbb8e3b93b54d8752",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "863dc7cd-d022-4d64-b729-236c13c76498",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        260,
        0
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "Rt0RWApx8PL9t0RF",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "7dc09659-1a38-4be4-baf8-e07312379205",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        500,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "3dd8c2aa-5dd9-4677-9ad7-a9cfa27c5da6",
      "name": "个人资料统计",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        20
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "={{ $now }}",
            "likes": "={{ $json.userProfile.heartCount }}",
            "videos": "={{ $json.userProfile.videoCount }}",
            "username": "={{ $('Loop Over Items').item.json.username }}",
            "followers ": "={{ $json.userProfile.followerCount }}",
            "following ": "={{ $json.userProfile.followingCount }}"
          },
          "schema": [
            {
              "id": "username",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "videos",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "videos",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "following ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "following ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "followers ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "followers ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "likes",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "likes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "Rt0RWApx8PL9t0RF",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "e8fc9e5c-5eb4-49fd-a60f-03ab3677f1c5",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ca95ec8a-8dba-4821-a3d6-9fc96bd39fdc",
      "name": "获取个人资料",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        20
      ],
      "parameters": {
        "url": "https://tiktok-api42.p.rapidapi.com/user_profile.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "username",
              "value": "={{ $json.username }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "tiktok-api42.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3cceba32-d50e-46a6-8f66-ea36ee42bdb9",
      "name": "获取视频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        660,
        440
      ],
      "parameters": {
        "url": "https://tiktok-api42.p.rapidapi.com/view_count.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "username",
              "value": "={{ $('Loop Over Items').item.json.username }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "tiktok-api42.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "97890005-4e87-4204-8779-e9404fd3a75f",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -180
      ],
      "parameters": {
        "width": 600,
        "height": 1280,
        "content": "# 📊 TikTok 分析自动化"
      },
      "typeVersion": 1
    },
    {
      "id": "26c5211b-bbf7-4cfa-998e-f2bdb0a94fa2",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -200
      ],
      "parameters": {
        "height": 360,
        "content": "**定时触发器**"
      },
      "typeVersion": 1
    },
    {
      "id": "66fe6fa5-7266-441d-a469-077715887da3",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -200
      ],
      "parameters": {
        "height": 360,
        "content": "**Google Sheets**"
      },
      "typeVersion": 1
    },
    {
      "id": "83162a57-ffb5-4d24-ab62-288ff2e07d4e",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -200
      ],
      "parameters": {
        "height": 360,
        "content": "**循环遍历项目**"
      },
      "typeVersion": 1
    },
    {
      "id": "f7a65bc9-e008-4e75-afe1-d477cd16d246",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -200
      ],
      "parameters": {
        "height": 360,
        "content": "- **获取个人资料**"
      },
      "typeVersion": 1
    },
    {
      "id": "ec2d2a17-ce62-434c-9f2c-727cb7a9967f",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        280
      ],
      "parameters": {
        "height": 320,
        "content": "- **获取视频**"
      },
      "typeVersion": 1
    },
    {
      "id": "5fbbbff4-97b3-4aa5-92ca-b6f903660a6a",
      "name": "便签 6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        260
      ],
      "parameters": {
        "height": 340,
        "content": "- **视频统计**"
      },
      "typeVersion": 1
    },
    {
      "id": "2b69a5a1-2e3f-4646-a495-05b2f6c63f90",
      "name": "视频统计",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1300,
        440
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "={{ $now }}",
            "days": "={{ $json.days }}",
            "user": "={{ $json.user }}",
            "videos": "={{ $json.videos }}",
            "success": "={{ $json.success }}",
            "username": "={{ $('Loop Over Items').item.json.username }}",
            "total_posts": "={{ $json.total_posts }}",
            "total_views": "={{ $json.total_views }}"
          },
          "schema": [
            {
              "id": "username",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "success",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "success",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_posts",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_posts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total_views",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total_views",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "videos",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "videos",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "user",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "user",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "days",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "days",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "Rt0RWApx8PL9t0RF",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "15d42bde-0278-47c7-9cb5-46d41056cac5",
      "name": "便签 7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -200
      ],
      "parameters": {
        "height": 360,
        "content": "- **个人资料统计**"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Fetch Videos": {
      "main": [
        [
          {
            "node": "Videos Stats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Videos Stats": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Profile": {
      "main": [
        [
          {
            "node": "Profile Stats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Profile Stats": {
      "main": [
        [
          {
            "node": "Fetch Videos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Fetch Profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 市场调研

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流