8
n8n 中文网amn8n.com

抓取Meta广告库并使用Gemini分析视频广告,将数据存储到Google Sheets

高级

这是一个AI, Marketing领域的自动化工作流,包含 24 个节点。主要使用 Set, Code, Sort, Wait, Limit 等节点,结合人工智能技术实现智能自动化。 使用Gemini分析Meta广告库视频广告,并将结果存储到Google Sheets

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "Yfi6wLGrS1JxYNeN",
  "meta": {
    "instanceId": "e57685206b2ffad6bb88e99d036876c83d8c4db170e93fa79e832ec88de4560b",
    "templateCredsSetupCompleted": true
  },
  "name": "抓取 Meta 广告库并使用 Gemini 分析视频广告,将数据存储到 Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "30c7e140-fafe-4ae7-9de9-a969857967d5",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -100,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d38614bf-bbcc-4619-bcc4-cb42a80a1148",
      "name": "Settings",
      "type": "n8n-nodes-base.set",
      "position": [
        100,
        380
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "7bb34d03-5cf0-497a-bead-87df84661ffd",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1960,
        380
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "d23fed5b-f230-4511-b4ea-76393617e740",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        3460,
        700
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e56dbefc-458f-40db-850e-f243740c5651",
      "name": "清理提示",
      "type": "n8n-nodes-base.code",
      "position": [
        300,
        380
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "6dbce614-58ce-4389-be16-a117ba5b6032",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        0
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1f26b54d-d0c5-483b-b3cf-e5e971128f2e",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3260,
        300
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e554fcd8-90f0-4f38-ad78-1b08f4cd4a82",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3360,
        860
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "96359003-2cd3-4ebf-90aa-8be4c44f1949",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3640,
        320
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3e3c13b8-063c-4e0d-99dd-93902646c197",
      "name": "存储数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3860,
        440
      ],
      "parameters": {},
      "typeVersion": 4.5
    },
    {
      "id": "717fa264-afc3-4e2f-a48a-f3101e3ccf97",
      "name": "结构化输出解析代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        3480,
        440
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1.7
    },
    {
      "id": "a61b82eb-21bf-4a0a-8863-e3fd3321c280",
      "name": "等待上传处理",
      "type": "n8n-nodes-base.wait",
      "position": [
        3020,
        440
      ],
      "webhookId": "a0e5485e-3f3c-47c6-ab19-9b9dc6158ab5",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "b3a0113f-a5e4-45e6-b093-a61ec5933446",
      "name": "传递值给 Gemini",
      "type": "n8n-nodes-base.set",
      "position": [
        2780,
        440
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "590f1356-4e6a-4e2a-aef4-9ec3c421b3bf",
      "name": "上传视频到 Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2580,
        440
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "88d88a31-4137-40e9-8470-4fb247cfac27",
      "name": "使用 Gemini 分析视频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3240,
        440
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "2168902d-1a0c-4807-9e88-08b9349ba19a",
      "name": "下载文件",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2200,
        440
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "4fc6c731-ac04-4b33-a7df-919bff17ddc1",
      "name": "将文件类型更改为视频",
      "type": "n8n-nodes-base.code",
      "position": [
        2380,
        440
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "9cb29e1e-be52-4f7d-90aa-c930d283d442",
      "name": "使用 Apify 抓取 Meta 广告库",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        500,
        380
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "59a198fa-3859-41a0-806b-280e9b9dd72a",
      "name": "传递相关字段",
      "type": "n8n-nodes-base.set",
      "position": [
        1720,
        380
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "ea30c850-3ae8-455e-9681-f42f59681a8a",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        3660,
        700
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "ac3ae0cd-8dda-4b38-858e-d3f4f21f7e5c",
      "name": "计算运行天数",
      "type": "n8n-nodes-base.set",
      "position": [
        700,
        380
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "28d391b3-d708-43a1-9d4b-28da08bc8175",
      "name": "按覆盖范围或运行天数排序",
      "type": "n8n-nodes-base.sort",
      "position": [
        960,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "82f7bdd7-5d20-4431-9772-4255e21ea963",
      "name": "仅筛选视频广告",
      "type": "n8n-nodes-base.filter",
      "position": [
        1200,
        380
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "b0a7273e-f540-49e9-98c2-f0437ea2749d",
      "name": "限制要分析的视频数量",
      "type": "n8n-nodes-base.limit",
      "position": [
        1460,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "79ac2590-6d68-4f1d-adb5-2c2fb5541f90",
  "connections": {
    "Settings": {
      "main": [
        [
          {
            "node": "Clean Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Data": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Prompt": {
      "main": [
        [
          {
            "node": "Scrape Meta Ad Library with Apify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Change Filetype to Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pass relevant Fields": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter only Video Ads": {
      "main": [
        [
          {
            "node": "Limit Videos to Analyze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pass Values for Gemini": {
      "main": [
        [
          {
            "node": "Wait for Upload Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video to Gemini": {
      "main": [
        [
          {
            "node": "Pass Values for Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit Videos to Analyze": {
      "main": [
        [
          {
            "node": "Pass relevant Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Change Filetype to Video": {
      "main": [
        [
          {
            "node": "Upload Video to Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parsing Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Structured Output Parsing Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Video with Gemini": {
      "main": [
        [
          {
            "node": "Structured Output Parsing Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Runtime in Days": {
      "main": [
        [
          {
            "node": "Sort by Reach or Days Running",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Upload Processing": {
      "main": [
        [
          {
            "node": "Analyze Video with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort by Reach or Days Running": {
      "main": [
        [
          {
            "node": "Filter only Video Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parsing Agent": {
      "main": [
        [
          {
            "node": "Store Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Meta Ad Library with Apify": {
      "main": [
        [
          {
            "node": "Calculate Runtime in Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人工智能, 营销

需要付费吗?

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

工作流信息
难度等级
高级
节点数量24
分类2
节点类型14
难度说明

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

外部链接
在 n8n.io 查看

分享此工作流